summaryrefslogtreecommitdiff
path: root/gcc/fixincludes
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-10-15 06:00:29 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-10-15 06:00:29 +0000
commit9e024bbb4e6059f129bd195527e9784e535220f4 (patch)
tree26fb88bd420cee94807a4d02fbb3ccde23b41ec5 /gcc/fixincludes
parentd0a131283e4d9660416a899096ce9cb1dba25f29 (diff)
downloadgcc-9e024bbb4e6059f129bd195527e9784e535220f4.tar.gz
* fixincludes: Add a HPUX 11 fix for inttypes.h.
* fixinc/inclhack.def: Same. * fixinc/inclhack.sh, fixinc/fixincl.sh, fixinc/fixincl.x: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30004 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fixincludes')
-rwxr-xr-xgcc/fixincludes36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/fixincludes b/gcc/fixincludes
index e5cc1c373b6..8c5843ae20b 100755
--- a/gcc/fixincludes
+++ b/gcc/fixincludes
@@ -2970,6 +2970,42 @@ if [ -r ${LIB}/$file ]; then
fi
fi
+# In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
+# of UINT32_C has undefined behavior according to ISO/ANSI:
+# the arguments to __CONCAT__ are not macro expanded before the
+# concatination happens so the trailing ')' in the first argument
+# is concatinated with the 'l' in the second argument creating an
+# invalid pp token. The behavior of invalid pp tokens is undefined.
+# GCC does not handle these invalid tokens the way the HP compiler does.
+# This problem will potentially occur anytime macros are used in the
+# arguments to __CONCAT__. A general solution to this problem would be to
+# insert another layer of macro between __CONCAT__ and its use
+# in UINT32_C. An example of this solution can be found in the C standard.
+# A more specific solution, the one used here, is to change the UINT32_C
+# macro to not used macros in the arguments to __CONCAT__.
+file=inttypes.h
+if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
+ cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
+ chmod +w ${LIB}/$file 2>/dev/null
+ chmod a+r ${LIB}/$file 2>/dev/null
+fi
+
+if [ -r ${LIB}/$file ]; then
+ echo "Fixing use of __CONCAT__ in $file"
+ sed -e 's/^#define UINT32_C(__c)\([ ]*\)__CONCAT__(__CONCAT_U__(__c),l)/#define UINT32_C(__c)\1__CONCAT__(__c,ul)/' \
+ ${LIB}/$file > ${LIB}/${file}.sed
+ rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
+ if cmp $file ${LIB}/$file >/dev/null 2>&1; then
+ rm -f ${LIB}/$file
+ else
+ # Find any include directives that use "file".
+ for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
+ dir=`echo $file | sed -e s'|/[^/]*$||'`
+ required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
+ done
+ fi
+fi
+
# Some math.h files define struct exception, which conflicts with
# the class exception defined in the C++ file std/stdexcept.h. We
# redefine it to __math_exception. This is not a great fix, but I