aboutsummaryrefslogtreecommitdiff
path: root/gcc/fixinc/inclhack.def
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2003-10-22 23:28:39 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2003-10-22 23:28:39 +0100
commitdc70e81d6e03635053815aba4360da3356ae5b24 (patch)
tree28a0768008d74d4ffb87685f8213007c87501bc9 /gcc/fixinc/inclhack.def
parent3c21d6e0f7c7b6d02686e24d0967ffffe85b61ad (diff)
downloadgcc-dc70e81d6e03635053815aba4360da3356ae5b24.zip
gcc-dc70e81d6e03635053815aba4360da3356ae5b24.tar.gz
gcc-dc70e81d6e03635053815aba4360da3356ae5b24.tar.bz2
obstack.h: Merge the following change from gnulib...
include: * obstack.h: Merge the following change from gnulib: 2003-10-21 Paul Eggert <eggert@twinsun.com> * obstack.h (obstack_1grow_fast): Properly parenthesize arg. (obstack_ptr_grow_fast, obstack_int_grow_fast): Don't use lvalue casts, as GCC plans to remove support for them in GCC 3.5. Reported by Joseph S. Myers. This bug was also present in the non-GCC version, indicating that this code had always been buggy and had never been widely used. (obstack_1grow, obstack_ptr_grow, obstack_int_grow, obstack_blank): Use the fast variant of each macro, rather than copying the definiens of the fast variant; that way, we'll be more likely to catch future bugs in the fast variants. gcc: * c-typeck.c (pedantic_lvalue_warning): Unconditionally warn of deprecation of casts as lvalues. * fixinc/inclhack.def (obstack_lvalue_cast): New fix. * fixinc/fixincl.x: Regenerate. * fixinc/tests/base/obstack.h: New test. gcc/testsuite: * gcc.dg/cast-lvalue-1.c: New test. From-SVN: r72826
Diffstat (limited to 'gcc/fixinc/inclhack.def')
-rw-r--r--gcc/fixinc/inclhack.def25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def
index 45a0bb8..2f285f5 100644
--- a/gcc/fixinc/inclhack.def
+++ b/gcc/fixinc/inclhack.def
@@ -1997,6 +1997,31 @@ fix = {
/*
+ * obstack.h used casts as lvalues.
+ *
+ * We need to change postincrements of casted pointers (which are
+ * then dereferenced and assigned into) of the form
+ *
+ * *((TYPE*)PTRVAR)++ = (VALUE)
+ *
+ * into expressions like
+ *
+ * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
+ *
+ * which is correct for the cases used in obstack.h since PTRVAR is
+ * of type char * and the value of the expression is not used.
+ */
+fix = {
+ hackname = obstack_lvalue_cast;
+ files = obstack.h;
+ select = '\*\(\(([^()]*)\*\)(.*)\)\+\+ = \(([^()]*)\)';
+ c_fix = format;
+ c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
+ test_text = "*((void **) (h)->next_free)++ = (aptr)";
+};
+
+
+/*
* sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
* defining regex.h related types. This causes libg++ build and usage
* failures. Fixing this correctly requires checking and modifying 3 files.