Skip to content

Commit

Permalink
compiler warning: stringop-overflow
Browse files Browse the repository at this point in the history
Adjust NCOPY macro to avoid stringop-overflow warning.
  • Loading branch information
jodavies committed Dec 5, 2024
1 parent 3b55753 commit 8c36a2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 2 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -806,12 +806,8 @@ DEBUGTOOL_LIBS=
# -------------------------------------
AC_DEFUN([AX_HANDLE_EXTRA_WARNING],
[if test "x$enable_extra_warning" != xyes; then
# Too many false positives.
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
AX_CHECK_COMPILE_FLAG([-Wno-stringop-overflow],
[$1="$$1 -Wno-stringop-overflow"],
[],
[-Werror])
# Currently no warnings are disabled without --enable-extra-warning
$1
fi[]dnl
])

Expand Down
3 changes: 2 additions & 1 deletion sources/declare.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
#define ParseSignedNumber(x,s) { int sgn; ParseSign(sgn,s)\
ParseNumber(x,s) if ( sgn ) x = -x; }

#define NCOPY(s,t,n) while ( --n >= 0 ) *s++ = *t++;
/* (n) is necessary here, since the macro is sometimes passed dereferenced pointers for n */
#define NCOPY(s,t,n) { while ( (n)-- > 0 ) { *s++ = *t++; } }

/*#define NCOPY(s,t,n) { memcpy(s,t,n*sizeof(WORD)); s+=n; t+=n; n = -1; }*/
#define NCOPYI(s,t,n) while ( --n >= 0 ) *s++ = *t++;
Expand Down

0 comments on commit 8c36a2e

Please sign in to comment.