aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-09-25 09:52:15 +0000
committerJakub Jelinek <jakub@redhat.com>2007-09-25 09:52:15 +0000
commit2d68b3d4fb4c43af582452c6a4f28a482638d441 (patch)
tree646c40c2a17dd6dfeab4a07817b562abaddc691e
parentf672b65ae588402785b1b26fdec91ae657b78601 (diff)
PR c++/33289
* decl.c (builtin_function_1): Set DECL_ANTICIPATED also on __*_chk non-__builtin_* decls. * g++.dg/eh/builtin4.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_1-branch@128754 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/eh/builtin4.C6
4 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 31896b9365d..51fcb5728ea 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2007-09-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/33289
+ * decl.c (builtin_function_1): Set DECL_ANTICIPATED also
+ on __*_chk non-__builtin_* decls.
+
2007-08-31 Jakub Jelinek <jakub@redhat.com>
* cp-tree.h (cp_disregard_inline_limits): New prototype.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 2b6080064d9..5241f87f4db 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3494,6 +3494,17 @@ builtin_function_1 (const char* name,
anticipated but not actually declared. */
if (name[0] != '_' || name[1] != '_')
DECL_ANTICIPATED (decl) = 1;
+ else if (strncmp (name + 2, "builtin_", strlen ("builtin_")) != 0)
+ {
+ size_t len = strlen (name);
+
+ /* Treat __*_chk fortification functions as anticipated as well,
+ unless they are __builtin_*. */
+ if (len > strlen ("___chk")
+ && memcmp (name + len - strlen ("_chk"),
+ "_chk", strlen ("_chk") + 1) == 0)
+ DECL_ANTICIPATED (decl) = 1;
+ }
/* Possibly apply some default attributes to this built-in function. */
if (attrs)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d52f476adfa..caf901bbcbf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-09-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/33289
+ * g++.dg/eh/builtin4.C: New test.
+
2007-08-29 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/sync-2.c (AI_ALIGN): Define if not defined.
diff --git a/gcc/testsuite/g++.dg/eh/builtin4.C b/gcc/testsuite/g++.dg/eh/builtin4.C
new file mode 100644
index 00000000000..32348174af6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/builtin4.C
@@ -0,0 +1,6 @@
+// PR c++/33289
+// { dg-do compile }
+
+typedef __SIZE_TYPE__ size_t;
+extern "C" int __sprintf_chk (char *__restrict, int, size_t, const char *, ...) throw ();
+extern "C" int __sprintf_chk (char *__restrict, int, size_t, const char *, ...) throw ();