summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr15698-1.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-02 19:39:04 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-02 19:39:04 +0000
commit3eafcdb5bf402c162e8b5f18a77a8afebfcc20a0 (patch)
treed9cc9fb4c89fa7f24c4b6b67239e8a3bb79274eb /gcc/testsuite/gcc.dg/pr15698-1.c
parent836c012512928660f99775081e13475b297972f7 (diff)
downloadgcc-3eafcdb5bf402c162e8b5f18a77a8afebfcc20a0.tar.gz
PR c/15698
* c-tree.h (C_DECL_BUILTIN_PROTOTYPE): New. * c-decl.c (current_function_prototype_built_in, current_function_prototype_arg_types): New. (merge_decls): Keep source location of prototype followed by nonprototype declaration. Update C_DECL_BUILTIN_PROTOTYPE. (builtin_function): Set C_DECL_BUILTIN_PROTOTYPE. (start_function): Always set current_function_prototype_locus, current_function_prototype_built_in and current_function_prototype_arg_types. Check for external prototype whether or not visible for external function and set current_function_prototype_arg_types accordingly. (store_parm_decls_oldstyle): Use current_function_prototype_arg_types for checking old-style definition against prototype. Give warnings only if current_function_prototype_built_in). testsuite: * gcc.dg/builtins-30.c: Update expected messages. * gcc.dg/pr15698-1.c, gcc.dg/pr15698-2.c, gcc.dg/pr15698-3.c, gcc.dg/pr15698-4.c, gcc.dg/pr15698-5.c, gcc.dg/pr15698-6.c, gcc.dg/pr15698-7.c, pr15698-8.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99118 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr15698-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr15698-1.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr15698-1.c b/gcc/testsuite/gcc.dg/pr15698-1.c
new file mode 100644
index 00000000000..6b1c4e2ee3f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr15698-1.c
@@ -0,0 +1,23 @@
+/* Test diagnostics for old-style definition not matching prior
+ prototype are present and give correct location for that prototype
+ (bug 15698). Original test. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+int foobar ();
+
+int func (int blah)
+{
+ char *rindex();
+}
+
+int foobar ()
+{
+ return 0;
+}
+
+char *rindex(a, b)
+ register char *a, b;
+{ /* { dg-warning "warning: argument 'a' doesn't match built-in prototype" } */
+ return 0;
+}