diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-03-05 18:14:47 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-03-05 18:14:47 +0000 |
commit | 59d6f6a4c05afa7f69dc616d7a7f7446ceb5433a (patch) | |
tree | 4fcd0d4434cb6e6f016fd87450f6a2df9a602c3f /proto.h | |
parent | 816005240f1a3b9989c940e630e829048597537c (diff) | |
download | perl-59d6f6a4c05afa7f69dc616d7a7f7446ceb5433a.tar.gz |
Avoid miniperl SEGVing when processing -I on the #! line
A side-effect of change 3185893b8dec1062 was to force av in S_incpush() to be
NULL, whilst other flag variables were still set as if it were non-NULL, for
certain cases, only when compiled with -DPERL_IS_MINIPERL
The "obvious" fix is to also set all the flag variables to 0 under
-DPERL_IS_MINIPERL, to make everything consistent. However, this confuses (at
least) the local version of gcc, which issues warnings about passing a NULL
value (av, known always to be NULL) as a not-NULL parameter, despite the fact
that all the relevant calls are inside blocks which are actually dead code,
due to the if() conditions being const variables set to 0 under
-DPERL_IS_MINIPERL.
So to avoid future bug reports about compiler warnings, the least worst thing
to do seems to be to use #ifndef to use the pre-processor to eliminate the
dead code, and related variables.
Diffstat (limited to 'proto.h')
-rw-r--r-- | proto.h | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -4676,6 +4676,17 @@ STATIC PerlIO * S_doopen_pm(pTHX_ SV *name) # endif #endif +#if !defined(PERL_IS_MINIPERL) +# if defined(PERL_IN_PERL_C) +STATIC SV * S_incpush_if_exists(pTHX_ AV *const av, SV *dir, SV *const stem) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); +#define PERL_ARGS_ASSERT_INCPUSH_IF_EXISTS \ + assert(av); assert(dir); assert(stem) + +# endif +#endif #if !defined(PERL_NO_UTF16_FILTER) # if defined(PERL_IN_TOKE_C) STATIC U8* S_add_utf16_textfilter(pTHX_ U8 *const s, bool reversed) @@ -5611,13 +5622,6 @@ STATIC void S_incpush(pTHX_ const char *const dir, STRLEN len, U32 flags) #define PERL_ARGS_ASSERT_INCPUSH \ assert(dir) -STATIC SV * S_incpush_if_exists(pTHX_ AV *const av, SV *dir, SV *const stem) - __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2) - __attribute__nonnull__(pTHX_3); -#define PERL_ARGS_ASSERT_INCPUSH_IF_EXISTS \ - assert(av); assert(dir); assert(stem) - STATIC void S_incpush_use_sep(pTHX_ const char *p, STRLEN len, U32 flags) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_INCPUSH_USE_SEP \ |