summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-08-31 17:41:14 -0600
committerKarl Williamson <public@khwilliamson.com>2012-09-13 21:14:00 -0600
commitd10c72f2acc0f7f1905e3ae965e6125449e9e851 (patch)
treeb548ca223928062c065c48768ab55b6734c4e8df
parentc865229611785bcce1879977411c34e80d36659a (diff)
downloadperl-d10c72f2acc0f7f1905e3ae965e6125449e9e851.tar.gz
/regcharclass.pl, utf8_strings.pl: Add guard to .h
Future commits will have other headers #include the headers generated by these programs. It is best to guard against the preprocessor from trying to process these twice
-rw-r--r--regcharclass.h6
-rwxr-xr-xregen/regcharclass.pl4
-rw-r--r--regen/utf8_strings.pl6
-rw-r--r--utf8_strings.h6
4 files changed, 22 insertions, 0 deletions
diff --git a/regcharclass.h b/regcharclass.h
index 0399fcaf65..d7db256a3c 100644
--- a/regcharclass.h
+++ b/regcharclass.h
@@ -12,6 +12,10 @@
* Any changes made here will be lost!
*/
+
+#ifndef H_REGCHARCLASS /* Guard against nested #includes */
+#define H_REGCHARCLASS 1
+
/*
LNBREAK: Line Break: \R
@@ -359,4 +363,6 @@
0x2029 == cp ) ) ) ) ) )
+#endif /* H_REGCHARCLASS */
+
/* ex: set ro: */
diff --git a/regen/regcharclass.pl b/regen/regcharclass.pl
index faf1572b7c..bcd5ebf8d5 100755
--- a/regen/regcharclass.pl
+++ b/regen/regcharclass.pl
@@ -626,6 +626,7 @@ if ( !caller ) {
print $out_fh read_only_top( lang => 'C', by => $0,
file => 'regcharclass.h', style => '*',
copyright => [2007, 2011] );
+ print $out_fh "\n#ifndef H_REGCHARCLASS /* Guard against nested #includes */\n#define H_REGCHARCLASS 1\n\n";
my ( $op, $title, @txt, @types, @mods );
my $doit= sub {
@@ -668,6 +669,9 @@ if ( !caller ) {
}
}
$doit->();
+
+ print $out_fh "\n#endif /* H_REGCHARCLASS */\n";
+
if($path eq '-') {
print $out_fh "/* ex: set ro: */\n";
} else {
diff --git a/regen/utf8_strings.pl b/regen/utf8_strings.pl
index d6d4c76208..0c703f8c4f 100644
--- a/regen/utf8_strings.pl
+++ b/regen/utf8_strings.pl
@@ -9,6 +9,10 @@ my $out_fh = open_new('utf8_strings.h', '>',
from => "Unicode data"});
print $out_fh <<END;
+
+#ifndef H_UTF8_STRINGS /* Guard against nested #includes */
+#define H_UTF8_STRINGS 1
+
/* This file contains #defines for various Unicode code points. The values
* for the macros are all or portions of the UTF-8 encoding for the code
* point. Note that the names all have the suffix "_UTF8".
@@ -92,6 +96,8 @@ while ( <DATA> ) {
print $out_fh "#define ${name}$suffix $str /* U+$cp */\n";
}
+print $out_fh "\n#endif /* H_UTF8_STRINGS */\n";
+
read_only_bottom_close_and_rename($out_fh);
__DATA__
diff --git a/utf8_strings.h b/utf8_strings.h
index a83d4231db..97b8359e00 100644
--- a/utf8_strings.h
+++ b/utf8_strings.h
@@ -4,6 +4,10 @@
* Any changes made here will be lost!
*/
+
+#ifndef H_UTF8_STRINGS /* Guard against nested #includes */
+#define H_UTF8_STRINGS 1
+
/* This file contains #defines for various Unicode code points. The values
* for the macros are all or portions of the UTF-8 encoding for the code
* point. Note that the names all have the suffix "_UTF8".
@@ -27,4 +31,6 @@
#define HANGUL_JONGSEONG_KIYEOK_UTF8 "\xE1\x86\xA8" /* U+11A8 */
#define HYPHEN_UTF8 "\xE2\x80\x90" /* U+2010 */
+#endif /* H_UTF8_STRINGS */
+
/* ex: set ro: */