summaryrefslogtreecommitdiff
path: root/gcc/mkconfig.sh
diff options
context:
space:
mode:
authorneroden <neroden@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-21 05:20:05 +0000
committerneroden <neroden@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-21 05:20:05 +0000
commit41cf95839302a8865495f7dadf5c54326d053c23 (patch)
tree8d526f24be7668426dfecc27d05d69233bb00e87 /gcc/mkconfig.sh
parent58f2079a1861b77c39e66c7d4d75861e34a24f33 (diff)
downloadgcc-41cf95839302a8865495f7dadf5c54326d053c23.tar.gz
* mkconfig.sh: Add multiple inclusion guards to generated headers.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68292 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/mkconfig.sh')
-rw-r--r--gcc/mkconfig.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
index 64d118f1a99..70d9a23d92d 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