Skip to content

Commit 7478fc5

Browse files
committed
compiler warning: stringop-overflow
Adjust NCOPY macros to avoid stringop-overflow warning.
1 parent a067d8f commit 7478fc5

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

configure.ac

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -806,12 +806,8 @@ DEBUGTOOL_LIBS=
806806
# -------------------------------------
807807
AC_DEFUN([AX_HANDLE_EXTRA_WARNING],
808808
[if test "x$enable_extra_warning" != xyes; then
809-
# Too many false positives.
810-
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
811-
AX_CHECK_COMPILE_FLAG([-Wno-stringop-overflow],
812-
[$1="$$1 -Wno-stringop-overflow"],
813-
[],
814-
[-Werror])
809+
# Currently no warnings are disabled without --enable-extra-warning
810+
$1
815811
fi[]dnl
816812
])
817813

sources/declare.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@
6767
#define ParseSignedNumber(x,s) { int sgn; ParseSign(sgn,s)\
6868
ParseNumber(x,s) if ( sgn ) x = -x; }
6969

70-
#define NCOPY(s,t,n) while ( --n >= 0 ) *s++ = *t++;
71-
70+
/* (n) is necessary here, since the macro is sometimes passed dereferenced pointers for n */
71+
#define NCOPY(s,t,n) { while ( (n)-- > 0 ) { *s++ = *t++; } }
7272
/*#define NCOPY(s,t,n) { memcpy(s,t,n*sizeof(WORD)); s+=n; t+=n; n = -1; }*/
73-
#define NCOPYI(s,t,n) while ( --n >= 0 ) *s++ = *t++;
74-
#define NCOPYB(s,t,n) while ( --n >= 0 ) *s++ = *t++;
75-
#define NCOPYI32(s,t,n) while ( --n >= 0 ) *s++ = *t++;
76-
#define WCOPY(s,t,n) { int nn=n; WORD *ss=(WORD *)s, *tt=(WORD *)t; while ( --nn >= 0 ) *ss++=*tt++; }
73+
#define NCOPYI(s,t,n) { while ( (n)-- > 0 ) { *s++ = *t++; } }
74+
#define NCOPYB(s,t,n) { while ( (n)-- > 0 ) { *s++ = *t++; } }
75+
#define NCOPYI32(s,t,n) { while ( (n)-- > 0 ) { *s++ = *t++; } }
76+
#define WCOPY(s,t,n) { int nn=n; WORD *ss=(WORD *)s, *tt=(WORD *)t; while ( (nn)-- > 0 ) { *ss++ = *tt++; } }
77+
7778
#define NeedNumber(x,s,err) { int sgn = 1; \
7879
while ( *s == ' ' || *s == '\t' || *s == '-' || *s == '+' ) { \
7980
if ( *s == '-' ) {sgn = -sgn;} s++; } \

0 commit comments

Comments
 (0)