diff options
author | Nathanael Nerode <neroden@gcc.gnu.org> | 2003-06-21 05:20:05 +0000 |
---|---|---|
committer | Nathanael Nerode <neroden@gcc.gnu.org> | 2003-06-21 05:20:05 +0000 |
commit | 5e7537cf9968e39a546718692500e9c2f9443034 (patch) | |
tree | 8d526f24be7668426dfecc27d05d69233bb00e87 | |
parent | 87b60e6481995233bd06cc2366a3d8aa4278108c (diff) | |
download | gcc-5e7537cf9968e39a546718692500e9c2f9443034.zip gcc-5e7537cf9968e39a546718692500e9c2f9443034.tar.gz gcc-5e7537cf9968e39a546718692500e9c2f9443034.tar.bz2 |
* mkconfig.sh: Add multiple inclusion guards to generated headers.
From-SVN: r68292
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/mkconfig.sh | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index afb35b1..9cdf9b3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2003-06-21 Nathanael Nerode <neroden@gcc.gnu.org> + + * mkconfig.sh: Add multiple inclusion guards to generated headers. + 2003-06-20 Neil Booth <neil@daikokuya.co.uk> * c-decl.c (store_parm_decls): Make saved_warn_shadow boolean. diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh index 64d118f..70d9a23 100644 --- a/gcc/mkconfig.sh +++ b/gcc/mkconfig.sh @@ -33,6 +33,14 @@ fi output=$1 rm -f ${output}T +# This converts a file name into header guard macro format. +hg_sed_expr='y,abcdefghijklmnopqrstuvwxyz./,ABCDEFGHIJKLMNOPQRSTUVWXYZ__,' +header_guard=GCC_`echo ${output} | sed -e ${hg_sed_expr}` + +# Add multiple inclusion protection guard, part one. +echo "#ifndef ${header_guard}" >> ${output}T +echo "#define ${header_guard}" >> ${output}T + # Define TARGET_CPU_DEFAULT if the system wants one. # This substitutes for lots of *.h files. if [ "$TARGET_CPU_DEFAULT" != "" ]; then @@ -85,6 +93,9 @@ EOF ;; esac +# Add multiple inclusion protection guard, part two. +echo "#endif /* ${header_guard} */" >> ${output}T + # Avoid changing the actual file if possible. if [ -f $output ] && cmp ${output}T $output >/dev/null 2>&1; then echo $output is unchanged >&2 |