diff --git a/src/code.h b/src/code.h index 4893a02d61..dcba1de842 100644 --- a/src/code.h +++ b/src/code.h @@ -16,7 +16,6 @@ #ifndef GAP_CODE_H #define GAP_CODE_H -#include "debug.h" #include "objects.h" /**************************************************************************** diff --git a/src/compiler.c b/src/compiler.c index 50a68ce21d..898b2f78de 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -2254,21 +2254,21 @@ CVar CompPow ( /**************************************************************************** ** *F CompIntExpr( ) . . . . . . . . . . . . . . . T_INTEXPR/T_INT_EXPR -* -* This is complicated by the need to produce code that will compile correctly -* in 32 or 64 bit and with or without GMP. -* -* The problem is that when we compile the code, we know the integer representation -* of the stored literal in the compiling process -* but NOT the representation which will apply to the compiled code or the endianness -* -* The solution to this is macros: C_MAKE_INTEGER_BAG( size, type) -* C_SET_LIMB4(bag, limbnumber, value) -* C_SET_LIMB8(bag, limbnumber, value) -* -* we compile using the one appropriate for the compiling system, but their -* definition depends on the limb size of the target system. -* +** +** This is complicated by the need to produce code that will compile +** correctly in 32 or 64 bit and with or without GMP. +** +** The problem is that when we compile the code, we know the integer +** representation of the stored literal in the compiling process but NOT the +** representation which will apply to the compiled code or the endianness +** +** The solution to this is macros: C_MAKE_INTEGER_BAG( size, type) +** C_SET_LIMB4(bag, limbnumber, value) +** C_SET_LIMB8(bag, limbnumber, value) +** +** we compile using the one appropriate for the compiling system, but their +** definition depends on the limb size of the target system. +** */ CVar CompIntExpr ( diff --git a/src/debug.h b/src/debug.h index 4f90969f3e..2f228031c7 100644 --- a/src/debug.h +++ b/src/debug.h @@ -12,9 +12,6 @@ #ifndef GAP_DEBUG_H #define GAP_DEBUG_H -#include "system.h" -#include - /* GAP_ASSERT is a version of 'assert' which is enabled by the ** configure option --enable-debug */ diff --git a/src/gapstate.h b/src/gapstate.h index 6bf41bffb7..7474bb5a8f 100644 --- a/src/gapstate.h +++ b/src/gapstate.h @@ -11,7 +11,7 @@ #ifndef GAP_GAPSTATE_H #define GAP_GAPSTATE_H -#include "debug.h" +#include "system.h" #if defined(HPCGAP) #include "hpc/tls.h" diff --git a/src/gasman.h b/src/gasman.h index 424554c4b3..8c5f6bffc7 100644 --- a/src/gasman.h +++ b/src/gasman.h @@ -37,7 +37,6 @@ #define GAP_GASMAN_H #include "system.h" -#include "debug.h" /**************************************************************************** diff --git a/src/intobj.h b/src/intobj.h index ed474dfe14..5b677f3f68 100644 --- a/src/intobj.h +++ b/src/intobj.h @@ -33,7 +33,6 @@ a #define GAP_INTOBJ_H #include "system.h" -#include "debug.h" #ifdef SYS_IS_64_BIT #define NR_SMALL_INT_BITS (64 - 4) diff --git a/src/objects.h b/src/objects.h index d21aa36817..4aecd81807 100644 --- a/src/objects.h +++ b/src/objects.h @@ -17,9 +17,8 @@ #ifndef GAP_OBJECTS_H #define GAP_OBJECTS_H -#include "debug.h" -#include "intobj.h" #include "gasman.h" +#include "intobj.h" #ifdef HPCGAP #define USE_THREADSAFE_COPYING diff --git a/src/plist.h b/src/plist.h index c1a66d03bc..0f956db3c8 100644 --- a/src/plist.h +++ b/src/plist.h @@ -26,7 +26,6 @@ #ifndef GAP_PLIST_H #define GAP_PLIST_H -#include "debug.h" #include "objects.h" /**************************************************************************** diff --git a/src/scanner.c b/src/scanner.c index 712bc3215b..ac528bd346 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -37,11 +37,12 @@ static UInt NextSymbol(void); */ static void SyntaxErrorOrWarning(const Char * msg, UInt error) { - // open error output - OpenOutput("*errout*"); - // do not print a message if we found one already on the current line if (STATE(NrErrLine) == 0) { + + // open error output + OpenOutput("*errout*"); + // print the message ... if (error) Pr("Syntax error: %s", (Int)msg, 0); @@ -66,6 +67,9 @@ static void SyntaxErrorOrWarning(const Char * msg, UInt error) Pr(" ", 0, 0); } Pr("^\n", 0, 0); + + // close error output + CloseOutput(); } if (error) { @@ -73,9 +77,6 @@ static void SyntaxErrorOrWarning(const Char * msg, UInt error) STATE(NrError)++; STATE(NrErrLine)++; } - - // close error output - CloseOutput(); } diff --git a/src/system.h b/src/system.h index 36f7aee07c..d6728f8d33 100644 --- a/src/system.h +++ b/src/system.h @@ -26,14 +26,16 @@ */ #include "config.h" +#include #include #include #include #include -#include #include +#include #include +#include "debug.h" /**************************************************************************** ** @@ -72,6 +74,11 @@ # error Something is wrong with this GAP installation: SIZEOF_VOID_P not defined #endif +// check that the pointer size detected by configure matches that of the +// current compiler; this helps prevent kernel extensions from being +// compiled with the wrong ABI +GAP_STATIC_ASSERT(sizeof(void *) == SIZEOF_VOID_P, "sizeof(void *) is wrong"); + #ifndef HAVE_DOTGAPRC /* define as 1 if the user resource file is ".gaprc" */ @@ -173,6 +180,10 @@ typedef Int4 Int; typedef UInt4 UInt; #endif +GAP_STATIC_ASSERT(sizeof(void *) == sizeof(Int), "sizeof(Int) is wrong"); +GAP_STATIC_ASSERT(sizeof(void *) == sizeof(UInt), "sizeof(UInt) is wrong"); + + /**************************************************************************** ** ** 'START_ENUM_RANGE' and 'END_ENUM_RANGE' simplify creating "ranges" of