Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel: don't include debug.h everywhere; and more #2536

Merged
merged 4 commits into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#ifndef GAP_CODE_H
#define GAP_CODE_H

#include "debug.h"
#include "objects.h"

/****************************************************************************
Expand Down
30 changes: 15 additions & 15 deletions src/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2254,21 +2254,21 @@ CVar CompPow (
/****************************************************************************
**
*F CompIntExpr( <expr> ) . . . . . . . . . . . . . . . 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 (
Expand Down
3 changes: 0 additions & 3 deletions src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
#ifndef GAP_DEBUG_H
#define GAP_DEBUG_H

#include "system.h"
#include <assert.h>

/* GAP_ASSERT is a version of 'assert' which is enabled by the
** configure option --enable-debug
*/
Expand Down
2 changes: 1 addition & 1 deletion src/gapstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/gasman.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#define GAP_GASMAN_H

#include "system.h"
#include "debug.h"


/****************************************************************************
Expand Down
1 change: 0 additions & 1 deletion src/intobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions src/objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/plist.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#ifndef GAP_PLIST_H
#define GAP_PLIST_H

#include "debug.h"
#include "objects.h"

/****************************************************************************
Expand Down
13 changes: 7 additions & 6 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do this?

Also, other people are (as I understand it) working on streams/error things at the moment. I worry this might conflict with them, particularly if it isn't actually doing anything useful?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To quote the commit message: "kernel: avoid unnecessarily opening output stream"

There are three error related open PRs: #2529, #2530, #2531. None of them modifies this file. Based on the discussion last week, I am also not aware of plans by @markuspf or @ssiccha to change this function, hopefully they'll correct me on that if necessary. I am aware of more planned changes related to error handling, namely by me, see PR #2520, but there is ni conflict there either...

// open error output
OpenOutput("*errout*");

// print the message ...
if (error)
Pr("Syntax error: %s", (Int)msg, 0);
Expand All @@ -66,16 +67,16 @@ static void SyntaxErrorOrWarning(const Char * msg, UInt error)
Pr(" ", 0, 0);
}
Pr("^\n", 0, 0);

// close error output
CloseOutput();
}

if (error) {
// one more error
STATE(NrError)++;
STATE(NrErrLine)++;
}

// close error output
CloseOutput();
}


Expand Down
13 changes: 12 additions & 1 deletion src/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@
*/
#include "config.h"

#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <setjmp.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "debug.h"

/****************************************************************************
**
Expand Down Expand Up @@ -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" */
Expand Down Expand Up @@ -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
Expand Down