Skip to content

Commit 6a5bc5a

Browse files
committed
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.
1 parent b063b0a commit 6a5bc5a

17 files changed

+47
-47
lines changed

XSUB.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
*
99
*/
1010

11-
#ifndef _INC_PERL_XSUB_H
12-
#define _INC_PERL_XSUB_H 1
11+
#ifndef PERL_XSUB_H_
12+
#define PERL_XSUB_H_ 1
1313

1414
/* first, some documentation for xsubpp-generated items */
1515

@@ -703,7 +703,7 @@ Rethrows a previously caught exception. See L<perlguts/"Exception Handling">.
703703
# endif /* NO_XSLOCKS */
704704
#endif /* PERL_IMPLICIT_SYS && !PERL_CORE */
705705

706-
#endif /* _INC_PERL_XSUB_H */ /* include guard */
706+
#endif /* PERL_XSUB_H_ */ /* include guard */
707707

708708
/*
709709
* ex: set ts=8 sts=4 sw=4 et:

dquote_inline.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* License or the Artistic License, as specified in the README file.
77
*/
88

9-
#ifndef DQUOTE_INLINE_H /* Guard against nested #inclusion */
10-
#define DQUOTE_INLINE_H
9+
#ifndef PERL_DQUOTE_INLINE_H_ /* Guard against nested #inclusion */
10+
#define PERL_DQUOTE_INLINE_H_
1111

1212
/*
1313
- regcurly - a little FSA that accepts {\d+,?\d*}
@@ -64,4 +64,4 @@ S_form_short_octal_warning(pTHX_
6464
(int) (s - sans_leading_zeros), sans_leading_zeros,
6565
*s);
6666
}
67-
#endif /* DQUOTE_INLINE_H */
67+
#endif /* PERL_DQUOTE_INLINE_H_ */

ebcdic_tables.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66

77

8-
#ifndef H_EBCDIC_TABLES /* Guard against nested #includes */
9-
#define H_EBCDIC_TABLES 1
8+
#ifndef PERL_EBCDIC_TABLES_H_ /* Guard against nested #includes */
9+
#define PERL_EBCDIC_TABLES_H_ 1
1010

1111
/* This file contains definitions for various tables used in EBCDIC handling.
1212
* More info is in utfebcdic.h */
@@ -437,6 +437,6 @@ EXTCONST U8 PL_fold_latin1[] = {
437437

438438
#endif /* EBCDIC 037 */
439439

440-
#endif /* H_EBCDIC_TABLES */
440+
#endif /* PERL_EBCDIC_TABLES_H_ */
441441

442442
/* ex: set ro: */

handy.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
/* IMPORTANT NOTE: Everything whose name begins with an underscore is for
1212
* internal core Perl use only. */
1313

14-
#ifndef HANDY_H /* Guard against nested #inclusion */
15-
#define HANDY_H
14+
#ifndef PERL_HANDY_H_ /* Guard against nested #inclusion */
15+
#define PERL_HANDY_H_
1616

1717
#if !defined(__STDC__)
1818
#ifdef NULL
@@ -2521,7 +2521,7 @@ void Perl_mem_log_del_sv(const SV *sv, const char *filename, const int linenumbe
25212521

25222522
#endif
25232523

2524-
#endif /* HANDY_H */
2524+
#endif /* PERL_HANDY_H_ */
25252525

25262526
/*
25272527
* ex: set ts=8 sts=4 sw=4 et:

malloc_ctl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef MALLOC_CTL_H
2-
# define MALLOC_CTL_H
1+
#ifndef PERL_MALLOC_CTL_H_
2+
# define PERL_MALLOC_CTL_H_
33

44
struct perl_mstats {
55
UV *nfree;

perlio.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
*
99
*/
1010

11-
#ifndef _PERLIO_H
12-
#define _PERLIO_H
11+
#ifndef PERLIO_H_
12+
#define PERLIO_H_
1313
/*
1414
Interface for perl to IO functions.
1515
There is a hierarchy of Configure determined #define controls:
@@ -336,7 +336,7 @@ typedef struct PerlIO_list_s PerlIO_list_t;
336336
#endif
337337

338338
END_EXTERN_C
339-
#endif /* _PERLIO_H */
339+
#endif /* PERLIO_H_ */
340340

341341
/*
342342
* ex: set ts=8 sts=4 sw=4 et:

perliol.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _PERLIOL_H
2-
#define _PERLIOL_H
1+
#ifndef PERLIOL_H_
2+
#define PERLIOL_H_
33

44
typedef struct {
55
PerlIO_funcs *funcs;
@@ -286,7 +286,7 @@ PERL_CALLCONV SSize_t PerlIOUnix_write(pTHX_ PerlIO *f, const void *vbuf, Size
286286
/* Utf8 */
287287
PERL_CALLCONV IV PerlIOUtf8_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab);
288288

289-
#endif /* _PERLIOL_H */
289+
#endif /* PERLIOL_H_ */
290290

291291
/*
292292
* ex: set ts=8 sts=4 sw=4 et:

reentr.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
* Any changes made here will be lost!
1313
*/
1414

15-
#ifndef REENTR_H
16-
#define REENTR_H
15+
#ifndef PERL_REENTR_H_
16+
#define PERL_REENTR_H_
1717

1818
/* If compiling for a threaded perl, we will macro-wrap the system/library
1919
* interfaces (e.g. getpwent()) which have threaded versions

regcharclass.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616

1717

18-
#ifndef H_REGCHARCLASS /* Guard against nested #includes */
19-
#define H_REGCHARCLASS 1
18+
#ifndef PERL_REGCHARCLASS_H_ /* Guard against nested #includes */
19+
#define PERL_REGCHARCLASS_H_
2020

2121
#if 'A' == 65 /* ASCII/Latin1 */
2222
/*
@@ -1851,7 +1851,7 @@
18511851

18521852
#endif /* EBCDIC 037 */
18531853

1854-
#endif /* H_REGCHARCLASS */
1854+
#endif /* PERL_REGCHARCLASS_H_ */
18551855

18561856
/* Generated from:
18571857
* 59e717586b720a821ee0d7397679d5322e38b49f6fb7840545aedf669c733b70 lib/Unicode/UCD.pm
@@ -1900,6 +1900,6 @@
19001900
* 717985d5fe0830f5b72ca21287a7d9f15ba6a383c29fbd3c47231d5f63edb68b lib/unicore/mktables
19011901
* cdecb300baad839a6f62791229f551a4fa33f3cbdca08e378dc976466354e778 lib/unicore/version
19021902
* 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl
1903-
* c468aea5062ef84422219d74e83b6f3216f2823544b445f53ee1af71deeb2044 regen/regcharclass.pl
1903+
* 9ea6338945a7d70e5ea4b31ac7856c0b521df96be002e94b4b3b7d31debbf3ab regen/regcharclass.pl
19041904
* 393f8d882713a3ba227351ad0f00ea4839fda74fcf77dcd1cdf31519925adba5 regen/regcharclass_multi_char_folds.pl
19051905
* ex: set ro: */

regen/ebcdic.pl

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ ($$;$)
4646

4747
print $out_fh <<END;
4848
49-
#ifndef H_EBCDIC_TABLES /* Guard against nested #includes */
50-
#define H_EBCDIC_TABLES 1
49+
#ifndef PERL_EBCDIC_TABLES_H_ /* Guard against nested #includes */
50+
#define PERL_EBCDIC_TABLES_H_ 1
5151
5252
/* This file contains definitions for various tables used in EBCDIC handling.
5353
* More info is in utfebcdic.h */
@@ -222,6 +222,6 @@ END
222222
print $out_fh get_conditional_compile_line_end();
223223
}
224224

225-
print $out_fh "\n#endif /* H_EBCDIC_TABLES */\n";
225+
print $out_fh "\n#endif /* PERL_EBCDIC_TABLES_H_ */\n";
226226

227227
read_only_bottom_close_and_rename($out_fh);

regen/reentr.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ sub open_print_header {
6262

6363
my $h = open_print_header('reentr.h');
6464
print $h <<EOF;
65-
#ifndef REENTR_H
66-
#define REENTR_H
65+
#ifndef PERL_REENTR_H_
66+
#define PERL_REENTR_H_
6767
6868
/* If compiling for a threaded perl, we will macro-wrap the system/library
6969
* interfaces (e.g. getpwent()) which have threaded versions

regen/regcharclass.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ sub make_macro {
13641364
changed or removed without notice.
13651365
EOF
13661366
);
1367-
print $out_fh "\n#ifndef H_REGCHARCLASS /* Guard against nested #includes */\n#define H_REGCHARCLASS 1\n";
1367+
print $out_fh "\n#ifndef PERL_REGCHARCLASS_H_ /* Guard against nested #includes */\n#define PERL_REGCHARCLASS_H_\n";
13681368

13691369
my ( $op, $title, @txt, @types, %mods );
13701370
my $doit= sub ($) {
@@ -1452,7 +1452,7 @@ sub make_macro {
14521452
print $out_fh get_conditional_compile_line_end();
14531453
}
14541454

1455-
print $out_fh "\n#endif /* H_REGCHARCLASS */\n";
1455+
print $out_fh "\n#endif /* PERL_REGCHARCLASS_H_ */\n";
14561456

14571457
if($path eq '-') {
14581458
print $out_fh "/* ex: set ro: */\n";

regen/unicode_constants.pl

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
print $out_fh <<END;
1414
15-
#ifndef H_UNICODE_CONSTANTS /* Guard against nested #includes */
16-
#define H_UNICODE_CONSTANTS 1
15+
#ifndef PERL_UNICODE_CONSTANTS_H_ /* Guard against nested #includes */
16+
#define PERL_UNICODE_CONSTANTS_H_ 1
1717
1818
/* This file contains #defines for the version of Unicode being used and
1919
* various Unicode code points. The values the code point macros expand to
@@ -198,7 +198,7 @@ END
198198
}
199199
}
200200

201-
print $out_fh "\n#endif /* H_UNICODE_CONSTANTS */\n";
201+
print $out_fh "\n#endif /* PERL_UNICODE_CONSTANTS_H_ */\n";
202202

203203
read_only_bottom_close_and_rename($out_fh);
204204

time64.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include <time.h>
22
#include "time64_config.h"
33

4-
#ifndef TIME64_H
5-
# define TIME64_H
4+
#ifndef PERL_TIME64_H_
5+
# define PERL_TIME64_H_
66

77

88
/* Set our custom types */

time64_config.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef TIME64_CONFIG_H
2-
# define TIME64_CONFIG_H
1+
#ifndef PERL_TIME64_CONFIG_H_
2+
# define PERL_TIME64_CONFIG_H_
33

44
/* Configuration
55
-------------
@@ -82,4 +82,4 @@
8282
#define SYSTEM_GMTIME_MAX CAT2(GMTIME_MAX,.0)
8383
#define SYSTEM_GMTIME_MIN CAT2(GMTIME_MIN,.0)
8484

85-
#endif /* TIME64_CONFIG_H */
85+
#endif /* PERL_TIME64_CONFIG_H_ */

unicode_constants.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66

77

8-
#ifndef H_UNICODE_CONSTANTS /* Guard against nested #includes */
9-
#define H_UNICODE_CONSTANTS 1
8+
#ifndef PERL_UNICODE_CONSTANTS_H_ /* Guard against nested #includes */
9+
#define PERL_UNICODE_CONSTANTS_H_ 1
1010

1111
/* This file contains #defines for the version of Unicode being used and
1212
* various Unicode code points. The values the code point macros expand to
@@ -182,6 +182,6 @@ bytes.
182182
/* The highest code point that has any type of case change */
183183
#define HIGHEST_CASE_CHANGING_CP_FOR_USE_ONLY_BY_UTF8_DOT_C 0x1E943
184184

185-
#endif /* H_UNICODE_CONSTANTS */
185+
#endif /* PERL_UNICODE_CONSTANTS_H_ */
186186

187187
/* ex: set ro: */

utf8.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
*
1515
*/
1616

17-
#ifndef H_UTF8 /* Guard against recursive inclusion */
18-
#define H_UTF8 1
17+
#ifndef PERL_UTF8_H_ /* Guard against recursive inclusion */
18+
#define PERL_UTF8_H_ 1
1919

2020
/* Use UTF-8 as the default script encoding?
2121
* Turning this on will break scripts having non-UTF-8 binary
@@ -1169,7 +1169,7 @@ L</is_utf8_string_loclen_flags> to check entire strings.
11691169
* retained solely for backwards compatibility */
11701170
#define IS_UTF8_CHAR(p, n) (isUTF8_CHAR(p, (p) + (n)) == n)
11711171

1172-
#endif /* H_UTF8 */
1172+
#endif /* PERL_UTF8_H_ */
11731173

11741174
/*
11751175
* ex: set ts=8 sts=4 sw=4 et:

0 commit comments

Comments
 (0)