]> granicus.if.org Git - gc/commitdiff
Workaround 'local variable end shadows outer symbol' cppcheck warnings
authorIvan Maidanski <ivmai@mail.ru>
Fri, 9 Nov 2018 07:35:36 +0000 (10:35 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 26 Nov 2018 07:13:08 +0000 (10:13 +0300)
* include/private/gcconfig.h [SPARC && FREEBSD] (end): Do not declare
external variable if CPPCHECK.
* include/private/gcconfig.h [MIPS && EWS4800 && (!_MIPS_SZPTR
|| _MIPS_SZPTR!=64)] (end): Likewise.
* include/private/gcconfig.h [ALPHA && FREEBSD] (end): Likewise.
* include/private/gcconfig.h [!DATAEND] (end): Likewise.
* include/private/gcconfig.h [I386 && RTEMS] (end): Do not declare
(because it automatically declared in DATAEND is undefined).
* include/private/gcconfig.h [I386 && RTEMS] (DATAEND): Do not define.
* include/private/gcconfig.h [MIPS && EWS4800]: Adjust indentation.

include/private/gcconfig.h

index 8ee2536970085689c1b3af4f959e11e639fb4270..4baffd523b4e872572c45f29e0bb5313e075a889 100644 (file)
@@ -1333,7 +1333,9 @@ EXTERN_C_BEGIN
 #       endif
         extern char etext[];
         extern char edata[];
-        extern char end[];
+#       if !defined(CPPCHECK)
+          extern char end[];
+#       endif
 #       define NEED_FIND_LIMIT
 #       define DATASTART ((ptr_t)(&etext))
         ptr_t GC_find_limit(ptr_t, GC_bool);
@@ -1659,11 +1661,9 @@ EXTERN_C_BEGIN
 #       include <sys/unistd.h>
         EXTERN_C_BEGIN
         extern int etext[];
-        extern int end[];
         void *rtems_get_stack_bottom(void);
 #       define InitStackBottom rtems_get_stack_bottom()
 #       define DATASTART ((ptr_t)etext)
-#       define DATAEND ((ptr_t)end)
 #       define STACKBOTTOM ((ptr_t)InitStackBottom)
 #       define SIG_SUSPEND SIGUSR1
 #       define SIG_THR_RESTART SIGUSR2
@@ -1759,27 +1759,30 @@ EXTERN_C_BEGIN
 #     endif
 #   endif /* Linux */
 #   ifdef EWS4800
-#      define HEURISTIC2
-#      if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
-         extern int _fdata[], _end[];
-#        define DATASTART ((ptr_t)_fdata)
-#        define DATAEND ((ptr_t)_end)
-#        define CPP_WORDSZ _MIPS_SZPTR
-#        define ALIGNMENT (_MIPS_SZPTR/8)
-#      else
-         extern int etext[], edata[], end[];
-         extern int _DYNAMIC_LINKING[], _gp[];
-#        define DATASTART ((ptr_t)((((word)(etext) + 0x3ffff) & ~0x3ffff) \
-                                   + ((word)(etext) & 0xffff)))
-#        define DATAEND ((ptr_t)(edata))
-#        define GC_HAVE_DATAREGION2
-#        define DATASTART2 (_DYNAMIC_LINKING \
-               ? (ptr_t)(((word)_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \
-               : (ptr_t)edata)
-#        define DATAEND2 ((ptr_t)(end))
-#        define ALIGNMENT 4
-#      endif
-#      define OS_TYPE "EWS4800"
+#     define HEURISTIC2
+#     if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
+        extern int _fdata[], _end[];
+#       define DATASTART ((ptr_t)_fdata)
+#       define DATAEND ((ptr_t)_end)
+#       define CPP_WORDSZ _MIPS_SZPTR
+#       define ALIGNMENT (_MIPS_SZPTR/8)
+#     else
+        extern int etext[], edata[];
+#       if !defined(CPPCHECK)
+          extern int end[];
+#       endif
+        extern int _DYNAMIC_LINKING[], _gp[];
+#       define DATASTART ((ptr_t)((((word)(etext) + 0x3ffff) & ~0x3ffff) \
+                                  + ((word)(etext) & 0xffff)))
+#       define DATAEND ((ptr_t)(edata))
+#       define GC_HAVE_DATAREGION2
+#       define DATASTART2 (_DYNAMIC_LINKING \
+                ? (ptr_t)(((word)_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \
+                : (ptr_t)edata)
+#       define DATAEND2 ((ptr_t)(end))
+#       define ALIGNMENT 4
+#     endif
+#     define OS_TYPE "EWS4800"
 #   endif
 #   ifdef ULTRIX
 #       define HEURISTIC2
@@ -2038,7 +2041,9 @@ EXTERN_C_BEGIN
 /* Handle unmapped hole alpha*-*-freebsd[45]* puts between etext and edata. */
         extern char etext[];
         extern char edata[];
-        extern char end[];
+#       if !defined(CPPCHECK)
+          extern char end[];
+#       endif
 #       define NEED_FIND_LIMIT
 #       define DATASTART ((ptr_t)(&etext))
         ptr_t GC_find_limit(ptr_t, GC_bool);
@@ -2930,7 +2935,9 @@ EXTERN_C_BEGIN
 #endif
 
 #ifndef DATAEND
-  extern int end[];
+# if !defined(CPPCHECK)
+    extern int end[];
+# endif
 # define DATAEND ((ptr_t)(end))
 #endif