Workaround '#error' cppcheck error messages
authorIvan Maidanski <ivmai@mail.ru>
Wed, 5 Oct 2016 22:12:55 +0000 (01:12 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 5 Oct 2016 22:12:55 +0000 (01:12 +0300)
* extra/msvc_dbg.c (GetStackFramesFromContext): Skip #error pragma
if CPPCHECK.
* include/private/gcconfig.h [sun && mc68000]: Likewise.
* include/private/gcconfig.h [hp9000s300 || ibm032 || _AUX_SOURCE
|| __pj__]: Likewise.
* include/private/gcconfig.h [!mach_type_known]: Likewise.
* include/private/gcconfig.h [HEXAGON && LINUX && !__ELF__]: Likewise.
* include/private/gcconfig.h [!ALIGNMENT || !STACKBOTTOM]: Likewise.
* os_dep.c [USE_MUNMAP && !USE_MMAP]: Likewise.
* os_dep.c [MPROTECT_VDB && DARWIN && !ARM32 && !AARCH64 && !POWERPC
&& !I386]: Likewise.

extra/msvc_dbg.c
include/private/gcconfig.h
os_dep.c

index abf4671..e7d7291 100644 (file)
@@ -158,8 +158,8 @@ size_t GetStackFramesFromContext(HANDLE hProcess, HANDLE hThread,
 #elif defined(_M_ALPHA64)
   machineType                 = IMAGE_FILE_MACHINE_ALPHA64;
   stackFrame.AddrPC.Offset    = context->Fir;
-#else
-#error Unknown CPU
+#elif !defined(CPPCHECK)
+# error Unknown CPU
 #endif
   for (frameIndex = 0; frameIndex < maxFrames; ) {
     BOOL bRet = StackWalk(machineType, hProcess, hThread, &stackFrame,
index d4a9199..98df369 100644 (file)
 #      define mach_type_known
 #    endif
 # endif
-# if defined(sun) && defined(mc68000)
+# if defined(sun) && defined(mc68000) && !defined(CPPCHECK)
 #    error SUNOS4 no longer supported
 # endif
-# if defined(hp9000s300)
+# if defined(hp9000s300) && !defined(CPPCHECK)
 #    error M68K based HP machines no longer supported.
 # endif
 # if defined(OPENBSD) && defined(m68k)
 #    define OS2
 #    define mach_type_known
 # endif
-# if defined(ibm032)
+# if defined(ibm032) && !defined(CPPCHECK)
 #   error IBM PC/RT no longer supported.
 # endif
 # if defined(sun) && (defined(sparc) || defined(__sparc))
 #   endif
 #   define mach_type_known
 # endif
-# if defined(_AUX_SOURCE)
+# if defined(_AUX_SOURCE) && !defined(CPPCHECK)
 #   error A/UX no longer supported
 # endif
 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
 #   define UTS4
 #   define mach_type_known
 # endif
-# if defined(__pj__)
+# if defined(__pj__) && !defined(CPPCHECK)
 #   error PicoJava no longer supported
     /* The implementation had problems, and I haven't heard of users    */
     /* in ages.  If you want it resurrected, let me know.               */
 /* Macros such as LINUX, FREEBSD, etc. distinguish them.                */
 /* SYSV on an M68K actually means A/UX.                                 */
 /* The distinction in these cases is usually the stack starting address */
-# ifndef mach_type_known
+# if !defined(mach_type_known) && !defined(CPPCHECK)
 #   error "The collector has not been ported to this machine/OS combination."
 # endif
                     /* Mapping is: M68K       ==> Motorola 680X0        */
 #            endif
              extern int _end[];
 #            define DATAEND ((ptr_t)(_end))
-#       else
+#       elif !defined(CPPCHECK)
 #            error --> bad Hexagon Linux configuration
 #       endif
 #   else
 # error --> bad word size
 #endif
 
-#ifndef ALIGNMENT
+#if !defined(ALIGNMENT) && !defined(CPPCHECK)
 # error --> undefined ALIGNMENT
 #endif
 
 # define PCR_VDB
 #endif
 
-#if !defined(STACKBOTTOM) && (defined(ECOS) || defined(NOSYS))
+#if !defined(STACKBOTTOM) && (defined(ECOS) || defined(NOSYS)) \
+    && !defined(CPPCHECK)
 # error --> undefined STACKBOTTOM
 #endif
 
index 92ff6d2..e5cbfb2 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -69,7 +69,7 @@
 #endif
 
 #if defined(MMAP_SUPPORTED) || defined(ADD_HEAP_GUARD_PAGES)
-# if defined(USE_MUNMAP) && !defined(USE_MMAP)
+# if defined(USE_MUNMAP) && !defined(USE_MMAP) && !defined(CPPCHECK)
 #   error "invalid config - USE_MUNMAP requires USE_MMAP"
 # endif
 # include <sys/types.h>
@@ -4199,7 +4199,7 @@ STATIC kern_return_t GC_forward_exception(mach_port_t thread, mach_port_t task,
 #   define DARWIN_EXC_STATE_T     x86_exception_state64_t
 # endif
 # define DARWIN_EXC_STATE_DAR     THREAD_FLD_NAME(faultvaddr)
-#else
+#elif !defined(CPPCHECK)
 # error FIXME for non-arm/ppc/x86 darwin
 #endif