* decl.c (duplicate_decls): Set TREE_NOTHROW on __builtin_XX
decl if a prototype for XX is provided with throw().
+ PR c++/33289
+ * decl.c (builtin_function_1): Set DECL_ANTICIPATED also
+ on __*_chk non-__builtin_* decls.
+
2007-09-05 Paolo Carlini <pcarlini@suse.de>
PR c++/30302
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;
+ }
return decl;
}
* g++.dg/eh/builtin2.C: New test.
* g++.dg/eh/builtin3.C: New test.
+ PR c++/33289
+ * g++.dg/eh/builtin4.C: New test.
+
2007-09-05 Janis Johnson <janis187@us.ibm.com>
* gcc.target/powerpc/dfp-dd.c: New test.
--- /dev/null
+// 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 ();