Skip to content
Open
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
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,17 @@ AS_IF([test $ok != yes],
[ok=yes;
AC_DEFINE([HAVE_POPCNT], [1], [Define to 1 if you have __popcnt function.])])
AC_MSG_RESULT($ok)])
AC_MSG_CHECKING([__attribute__((noreturn))])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([extern void fatal() __attribute__((noreturn));], [return 0;])],
[
AC_DEFINE(NORETURN, [__attribute__((noreturn))], [The "noreturn" function attribute.])
AC_MSG_RESULT([yes])
],
[
AC_DEFINE(NORETURN, [], [The "noreturn" function attribute.])
AC_MSG_RESULT([no])
])

# Check for inline
AC_C_INLINE
Expand Down
10 changes: 5 additions & 5 deletions sources/declare.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ static inline ULONG LongAbs(LONG x)
*/
static inline int UnsignedToInt(unsigned int x)
{
extern void TerminateImpl(int, const char*, int, const char*);
extern void TerminateImpl(int, const char*, int, const char*) NORETURN;
if ( x <= INT_MAX ) return(x);
if ( x >= (unsigned int)INT_MIN )
return((int)(x - (unsigned int)INT_MIN) + INT_MIN);
Expand All @@ -420,7 +420,7 @@ static inline int UnsignedToInt(unsigned int x)

static inline WORD UWordToWord(UWORD x)
{
extern void TerminateImpl(int, const char*, int, const char*);
extern void TerminateImpl(int, const char*, int, const char*) NORETURN;
if ( x <= WORD_MAX_VALUE ) return(x);
if ( x >= (UWORD)WORD_MIN_VALUE )
return((WORD)(x - (UWORD)WORD_MIN_VALUE) + WORD_MIN_VALUE);
Expand All @@ -430,7 +430,7 @@ static inline WORD UWordToWord(UWORD x)

static inline LONG ULongToLong(ULONG x)
{
extern void TerminateImpl(int, const char*, int, const char*);
extern void TerminateImpl(int, const char*, int, const char*) NORETURN;
if ( x <= LONG_MAX_VALUE ) return(x);
if ( x >= (ULONG)LONG_MIN_VALUE )
return((LONG)(x - (ULONG)LONG_MIN_VALUE) + LONG_MIN_VALUE);
Expand Down Expand Up @@ -791,7 +791,7 @@ extern void PositionStream(STREAM *,LONG);
extern int ReverseStatements(STREAM *);
extern int ProcessOption(UBYTE *,UBYTE *,int);
extern int DoSetups(void);
extern void TerminateImpl(int, const char *,int, const char *);
extern void TerminateImpl(int, const char *,int, const char *) NORETURN;
extern NAMENODE *GetNode(NAMETREE *,UBYTE *);
extern int AddName(NAMETREE *,UBYTE *,WORD,WORD,int *);
extern int GetName(NAMETREE *,UBYTE *,WORD *,int);
Expand Down Expand Up @@ -990,7 +990,7 @@ extern int DoPolyratfun(UBYTE *);
extern int CompileStatement(UBYTE *);
extern UBYTE *ToToken(UBYTE *);
extern int GetDollar(UBYTE *);
extern int MesWork(void);
extern void MesWork(void) NORETURN;
extern int MesPrint(const char *,...);
extern int MesCall(char *);
extern UBYTE *NumCopy(WORD,UBYTE *);
Expand Down
4 changes: 3 additions & 1 deletion sources/execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,9 @@ WORD PutBracket(PHEAD WORD *termin)
WORD *bbb = 0, *bind, *binst = 0, bwild = 0, *bss = 0, *bns = 0, bset = 0;
term1 = AT.WorkPointer+1;
term2 = (WORD *)(((UBYTE *)(term1)) + AM.MaxTer);
if ( ( (WORD *)(((UBYTE *)(term2)) + AM.MaxTer) ) > AT.WorkTop ) return(MesWork());
if ( ( (WORD *)(((UBYTE *)(term2)) + AM.MaxTer) ) > AT.WorkTop ) {
MesWork();
}
if ( AR.BracketOn < 0 ) {
t2 = term1; t1 = term2; /* AntiBracket */
}
Expand Down
9 changes: 4 additions & 5 deletions sources/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static char hex[] = {'0','1','2','3','4','5','6','7','8','9',
#[ Error0 :
*/

void Error0(char *s)
NORETURN void Error0(char *s)
{
MesPrint("=== %s",s);
Terminate(-1);
Expand All @@ -64,7 +64,7 @@ void Error0(char *s)
#[ Error1 :
*/

void Error1(char *s, UBYTE *t)
NORETURN void Error1(char *s, UBYTE *t)
{
MesPrint("@%s %s",s,t);
Terminate(-1);
Expand All @@ -75,7 +75,7 @@ void Error1(char *s, UBYTE *t)
#[ Error2 :
*/

void Error2(char *s1, char *s2, UBYTE *t)
NORETURN void Error2(char *s1, char *s2, UBYTE *t)
{
MesPrint("@%s%s %s",s1,s2,t);
Terminate(-1);
Expand All @@ -86,12 +86,11 @@ void Error2(char *s1, char *s2, UBYTE *t)
#[ MesWork :
*/

int MesWork(void)
NORETURN void MesWork(void)
{
MesPrint("=== Workspace overflow. %l bytes is not enough.",AM.WorkSize);
MesPrint("=== Change parameter WorkSpace in %s",setupfilename);
Terminate(-1);
return(-1);
}

/*
Expand Down
4 changes: 3 additions & 1 deletion sources/parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,9 @@ int PF_Processor(EXPRESSIONS e, WORD i, WORD LastExpression)
}
#endif

if ( ( (WORD *)(((UBYTE *)(AT.WorkPointer)) + AM.MaxTer ) ) > AT.WorkTop ) return(MesWork());
if ( ( (WORD *)(((UBYTE *)(AT.WorkPointer)) + AM.MaxTer ) ) > AT.WorkTop ) {
MesWork();
}

/* For redefine statements. */
if ( AC.numpfirstnum > 0 ) {
Expand Down
4 changes: 3 additions & 1 deletion sources/proces.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ WORD Processor(void)
AR.CompressPointer = AR.CompressBuffer;
AR.NoCompress = AC.NoCompress;
term = AT.WorkPointer;
if ( ( (WORD *)(((UBYTE *)(AT.WorkPointer)) + AM.MaxTer) ) > AT.WorkTop ) return(MesWork());
if ( ( (WORD *)(((UBYTE *)(AT.WorkPointer)) + AM.MaxTer) ) > AT.WorkTop ) {
MesWork();
}
UpdatePositions();
C->rhs[C->numrhs+1] = C->Pointer;
AR.KeptInHold = 0;
Expand Down
2 changes: 1 addition & 1 deletion sources/reshuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,7 @@ WORD DoPartitions(PHEAD WORD *term, WORD level)
t2 = twhere+twhere[1];
to = termout = AT.WorkPointer;
if ( termout + *term + part.numpart*FUNHEAD + AM.MaxTal >= AT.WorkTop ) {
return(MesWork());
MesWork();
}
for ( i = 0; i < ncoeffnum; i++ ) coeff[i] = coeffnum[i];
ncoeff = ncoeffnum;
Expand Down
4 changes: 2 additions & 2 deletions sources/sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ WORD PutOut(PHEAD WORD *term, POSITION *position, FILEHANDLE *fi, WORD ncomp)
MLOCK(ErrorMessageLock);
MesPrint("Ran into precompressed term");
MUNLOCK(ErrorMessageLock);
Crash();
Terminate(-1);
return(-1);
}
}
Expand Down Expand Up @@ -1617,7 +1617,7 @@ WORD PutOut(PHEAD WORD *term, POSITION *position, FILEHANDLE *fi, WORD ncomp)
MLOCK(ErrorMessageLock);
MesPrint("CompressSize of %10l is insufficient",AM.CompressSize);
MUNLOCK(ErrorMessageLock);
Crash();
Terminate(-1);
return(-1);
}
}
Expand Down
Loading