From 6a5bc5acd0f35a93138716f5c3681baa1e139c65 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Thu, 20 Apr 2017 10:16:11 -0600 Subject: [PATCH] Use new paradigm for hdr file double inclusion guard We changed to use symbols not likely to be used by non-Perl code that could conflict, and which have trailing underbars, so they don't look like a regular Perl #define. See https://rt.perl.org/Ticket/Display.html?id=131110 There are many more header files which are not guarded. --- XSUB.h | 6 +++--- dquote_inline.h | 6 +++--- ebcdic_tables.h | 6 +++--- handy.h | 6 +++--- malloc_ctl.h | 4 ++-- perlio.h | 6 +++--- perliol.h | 6 +++--- reentr.h | 4 ++-- regcharclass.h | 8 ++++---- regen/ebcdic.pl | 6 +++--- regen/reentr.pl | 4 ++-- regen/regcharclass.pl | 4 ++-- regen/unicode_constants.pl | 6 +++--- time64.h | 4 ++-- time64_config.h | 6 +++--- unicode_constants.h | 6 +++--- utf8.h | 6 +++--- 17 files changed, 47 insertions(+), 47 deletions(-) diff --git a/XSUB.h b/XSUB.h index ec7b58d..cff8204 100644 --- a/XSUB.h +++ b/XSUB.h @@ -8,8 +8,8 @@ * */ -#ifndef _INC_PERL_XSUB_H -#define _INC_PERL_XSUB_H 1 +#ifndef PERL_XSUB_H_ +#define PERL_XSUB_H_ 1 /* first, some documentation for xsubpp-generated items */ @@ -703,7 +703,7 @@ Rethrows a previously caught exception. See L. # endif /* NO_XSLOCKS */ #endif /* PERL_IMPLICIT_SYS && !PERL_CORE */ -#endif /* _INC_PERL_XSUB_H */ /* include guard */ +#endif /* PERL_XSUB_H_ */ /* include guard */ /* * ex: set ts=8 sts=4 sw=4 et: diff --git a/dquote_inline.h b/dquote_inline.h index 1c7694d..f0ce9d6 100644 --- a/dquote_inline.h +++ b/dquote_inline.h @@ -6,8 +6,8 @@ * License or the Artistic License, as specified in the README file. */ -#ifndef DQUOTE_INLINE_H /* Guard against nested #inclusion */ -#define DQUOTE_INLINE_H +#ifndef PERL_DQUOTE_INLINE_H_ /* Guard against nested #inclusion */ +#define PERL_DQUOTE_INLINE_H_ /* - regcurly - a little FSA that accepts {\d+,?\d*} @@ -64,4 +64,4 @@ S_form_short_octal_warning(pTHX_ (int) (s - sans_leading_zeros), sans_leading_zeros, *s); } -#endif /* DQUOTE_INLINE_H */ +#endif /* PERL_DQUOTE_INLINE_H_ */ diff --git a/ebcdic_tables.h b/ebcdic_tables.h index c36ab96..69ab372 100644 --- a/ebcdic_tables.h +++ b/ebcdic_tables.h @@ -5,8 +5,8 @@ */ -#ifndef H_EBCDIC_TABLES /* Guard against nested #includes */ -#define H_EBCDIC_TABLES 1 +#ifndef PERL_EBCDIC_TABLES_H_ /* Guard against nested #includes */ +#define PERL_EBCDIC_TABLES_H_ 1 /* This file contains definitions for various tables used in EBCDIC handling. * More info is in utfebcdic.h */ @@ -437,6 +437,6 @@ EXTCONST U8 PL_fold_latin1[] = { #endif /* EBCDIC 037 */ -#endif /* H_EBCDIC_TABLES */ +#endif /* PERL_EBCDIC_TABLES_H_ */ /* ex: set ro: */ diff --git a/handy.h b/handy.h index 80f9cf4..c3848bf 100644 --- a/handy.h +++ b/handy.h @@ -11,8 +11,8 @@ /* IMPORTANT NOTE: Everything whose name begins with an underscore is for * internal core Perl use only. */ -#ifndef HANDY_H /* Guard against nested #inclusion */ -#define HANDY_H +#ifndef PERL_HANDY_H_ /* Guard against nested #inclusion */ +#define PERL_HANDY_H_ #if !defined(__STDC__) #ifdef NULL @@ -2521,7 +2521,7 @@ void Perl_mem_log_del_sv(const SV *sv, const char *filename, const int linenumbe #endif -#endif /* HANDY_H */ +#endif /* PERL_HANDY_H_ */ /* * ex: set ts=8 sts=4 sw=4 et: diff --git a/malloc_ctl.h b/malloc_ctl.h index d746372..0c72e9a 100644 --- a/malloc_ctl.h +++ b/malloc_ctl.h @@ -1,5 +1,5 @@ -#ifndef MALLOC_CTL_H -# define MALLOC_CTL_H +#ifndef PERL_MALLOC_CTL_H_ +# define PERL_MALLOC_CTL_H_ struct perl_mstats { UV *nfree; diff --git a/perlio.h b/perlio.h index 1a3d480..d515020 100644 --- a/perlio.h +++ b/perlio.h @@ -8,8 +8,8 @@ * */ -#ifndef _PERLIO_H -#define _PERLIO_H +#ifndef PERLIO_H_ +#define PERLIO_H_ /* Interface for perl to IO functions. There is a hierarchy of Configure determined #define controls: @@ -336,7 +336,7 @@ typedef struct PerlIO_list_s PerlIO_list_t; #endif END_EXTERN_C -#endif /* _PERLIO_H */ +#endif /* PERLIO_H_ */ /* * ex: set ts=8 sts=4 sw=4 et: diff --git a/perliol.h b/perliol.h index d15c937..40b4224 100644 --- a/perliol.h +++ b/perliol.h @@ -1,5 +1,5 @@ -#ifndef _PERLIOL_H -#define _PERLIOL_H +#ifndef PERLIOL_H_ +#define PERLIOL_H_ typedef struct { PerlIO_funcs *funcs; @@ -286,7 +286,7 @@ PERL_CALLCONV SSize_t PerlIOUnix_write(pTHX_ PerlIO *f, const void *vbuf, Size /* Utf8 */ PERL_CALLCONV IV PerlIOUtf8_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab); -#endif /* _PERLIOL_H */ +#endif /* PERLIOL_H_ */ /* * ex: set ts=8 sts=4 sw=4 et: diff --git a/reentr.h b/reentr.h index b1f3c80..b220b1e 100644 --- a/reentr.h +++ b/reentr.h @@ -12,8 +12,8 @@ * Any changes made here will be lost! */ -#ifndef REENTR_H -#define REENTR_H +#ifndef PERL_REENTR_H_ +#define PERL_REENTR_H_ /* If compiling for a threaded perl, we will macro-wrap the system/library * interfaces (e.g. getpwent()) which have threaded versions diff --git a/regcharclass.h b/regcharclass.h index ff00207..7879574 100644 --- a/regcharclass.h +++ b/regcharclass.h @@ -15,8 +15,8 @@ */ -#ifndef H_REGCHARCLASS /* Guard against nested #includes */ -#define H_REGCHARCLASS 1 +#ifndef PERL_REGCHARCLASS_H_ /* Guard against nested #includes */ +#define PERL_REGCHARCLASS_H_ #if 'A' == 65 /* ASCII/Latin1 */ /* @@ -1851,7 +1851,7 @@ #endif /* EBCDIC 037 */ -#endif /* H_REGCHARCLASS */ +#endif /* PERL_REGCHARCLASS_H_ */ /* Generated from: * 59e717586b720a821ee0d7397679d5322e38b49f6fb7840545aedf669c733b70 lib/Unicode/UCD.pm @@ -1900,6 +1900,6 @@ * 717985d5fe0830f5b72ca21287a7d9f15ba6a383c29fbd3c47231d5f63edb68b lib/unicore/mktables * cdecb300baad839a6f62791229f551a4fa33f3cbdca08e378dc976466354e778 lib/unicore/version * 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl - * c468aea5062ef84422219d74e83b6f3216f2823544b445f53ee1af71deeb2044 regen/regcharclass.pl + * 9ea6338945a7d70e5ea4b31ac7856c0b521df96be002e94b4b3b7d31debbf3ab regen/regcharclass.pl * 393f8d882713a3ba227351ad0f00ea4839fda74fcf77dcd1cdf31519925adba5 regen/regcharclass_multi_char_folds.pl * ex: set ro: */ diff --git a/regen/ebcdic.pl b/regen/ebcdic.pl index a3e049d..5fd4ecd 100644 --- a/regen/ebcdic.pl +++ b/regen/ebcdic.pl @@ -46,8 +46,8 @@ sub output_table ($$;$) { print $out_fh <', print $out_fh < #include "time64_config.h" -#ifndef TIME64_H -# define TIME64_H +#ifndef PERL_TIME64_H_ +# define PERL_TIME64_H_ /* Set our custom types */ diff --git a/time64_config.h b/time64_config.h index 42cc12c..0bebebb 100644 --- a/time64_config.h +++ b/time64_config.h @@ -1,5 +1,5 @@ -#ifndef TIME64_CONFIG_H -# define TIME64_CONFIG_H +#ifndef PERL_TIME64_CONFIG_H_ +# define PERL_TIME64_CONFIG_H_ /* Configuration ------------- @@ -82,4 +82,4 @@ #define SYSTEM_GMTIME_MAX CAT2(GMTIME_MAX,.0) #define SYSTEM_GMTIME_MIN CAT2(GMTIME_MIN,.0) -#endif /* TIME64_CONFIG_H */ +#endif /* PERL_TIME64_CONFIG_H_ */ diff --git a/unicode_constants.h b/unicode_constants.h index 1c0e62e..318b901 100644 --- a/unicode_constants.h +++ b/unicode_constants.h @@ -5,8 +5,8 @@ */ -#ifndef H_UNICODE_CONSTANTS /* Guard against nested #includes */ -#define H_UNICODE_CONSTANTS 1 +#ifndef PERL_UNICODE_CONSTANTS_H_ /* Guard against nested #includes */ +#define PERL_UNICODE_CONSTANTS_H_ 1 /* This file contains #defines for the version of Unicode being used and * various Unicode code points. The values the code point macros expand to @@ -182,6 +182,6 @@ bytes. /* The highest code point that has any type of case change */ #define HIGHEST_CASE_CHANGING_CP_FOR_USE_ONLY_BY_UTF8_DOT_C 0x1E943 -#endif /* H_UNICODE_CONSTANTS */ +#endif /* PERL_UNICODE_CONSTANTS_H_ */ /* ex: set ro: */ diff --git a/utf8.h b/utf8.h index 7b2ba14..41db2f4 100644 --- a/utf8.h +++ b/utf8.h @@ -14,8 +14,8 @@ * */ -#ifndef H_UTF8 /* Guard against recursive inclusion */ -#define H_UTF8 1 +#ifndef PERL_UTF8_H_ /* Guard against recursive inclusion */ +#define PERL_UTF8_H_ 1 /* Use UTF-8 as the default script encoding? * Turning this on will break scripts having non-UTF-8 binary @@ -1169,7 +1169,7 @@ L to check entire strings. * retained solely for backwards compatibility */ #define IS_UTF8_CHAR(p, n) (isUTF8_CHAR(p, (p) + (n)) == n) -#endif /* H_UTF8 */ +#endif /* PERL_UTF8_H_ */ /* * ex: set ts=8 sts=4 sw=4 et: -- 1.8.3.1