diff options
author | Karl Williamson <khw@cpan.org> | 2018-12-30 21:29:07 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2019-01-05 10:42:26 -0700 |
commit | 8c165a32b7cc4f2a147a37c920a96f1b09b2386d (patch) | |
tree | 86b73c56af6a273a3985db49330d31068995f692 /warnings.h | |
parent | 81f816b3b4c1f7193f4c870874ef3879c690373f (diff) | |
download | perl-8c165a32b7cc4f2a147a37c920a96f1b09b2386d.tar.gz |
regen/warnings.pl: Fix undefined C behavior
This fixes compiler warnings "performing pointer arithmetic on a null
pointer has undefined behavior"
There are several ways to fix this. This one was suggested by
Tomasz Konojacki++. Instead of trying to point to address 1 and 2, two
variables are created, and we point to them. const is cast away.
Diffstat (limited to 'warnings.h')
-rw-r--r-- | warnings.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/warnings.h b/warnings.h index e0c12ed403..58f52272de 100644 --- a/warnings.h +++ b/warnings.h @@ -18,8 +18,8 @@ #define G_WARN_ALL_MASK (G_WARN_ALL_ON|G_WARN_ALL_OFF) #define pWARN_STD NULL -#define pWARN_ALL (((STRLEN*)0)+1) /* use warnings 'all' */ -#define pWARN_NONE (((STRLEN*)0)+2) /* no warnings 'all' */ +#define pWARN_ALL (STRLEN *) &PL_WARN_ALL /* use warnings 'all' */ +#define pWARN_NONE (STRLEN *) &PL_WARN_NONE /* no warnings 'all' */ #define specialWARN(x) ((x) == pWARN_STD || (x) == pWARN_ALL || \ (x) == pWARN_NONE) |