[committed] PR C/12466 (take 3)
Kelley Cook
kelleycook@wideopenwest.com
Thu Oct 2 00:12:00 GMT 2003
On Tue, 30 Sep 2003 21:16:03 -0700, Richard Henderson wrote:
>On Tue, Sep 30, 2003 at 10:08:34PM -0400, Kelley Cook wrote:
>> * c-parse.in (parmlist_2): Mark declaration with an ellipsis as ISO C.
>> * gcc.dg/Wold-style-definition-1.c: Add in 2 ellipsis testcases.
>Ok.
Here is what was committed after taking in testcase suggestions from Kaveh and
Hans-Peter.
gcc:
PR C/12466
* c-parse.in (parmlist_2): Mark declaration with an ellipsis as ISO C.
gcc/testsuite:
* gcc.dg/Wold-style-definition-2.c: New testcase.
* gcc.dg/wtr-func-def-1.c: Modify to reflect new warning.
Index: c-parse.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-parse.in,v
retrieving revision 1.185
diff -c -p -r1.185 c-parse.in
*** c-parse.in 25 Sep 2003 07:17:02 -0000 1.185
--- c-parse.in 1 Oct 2003 23:54:19 -0000
*************** parmlist_2: /* empty */
*** 2561,2573 ****
tries to verify that BUILT_IN_NEXT_ARG is being used
correctly. */
error ("ISO C requires a named argument before `...'");
}
| parms
{ $$ = get_parm_info (1);
parsing_iso_function_signature = true;
}
| parms ',' ELLIPSIS
! { $$ = get_parm_info (0); }
;
parms:
--- 2561,2576 ----
tries to verify that BUILT_IN_NEXT_ARG is being used
correctly. */
error ("ISO C requires a named argument before `...'");
+ parsing_iso_function_signature = true;
}
| parms
{ $$ = get_parm_info (1);
parsing_iso_function_signature = true;
}
| parms ',' ELLIPSIS
! { $$ = get_parm_info (0);
! parsing_iso_function_signature = true;
! }
;
parms:
Index: testsuite/gcc.dg/Wold-style-definition-2.c
===================================================================
RCS file: testsuite/gcc.dg/Wold-style-definition-2.c
diff -N testsuite/gcc.dg/Wold-style-definition-2.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/Wold-style-definition-2.c 1 Oct 2003 23:54:25 -0000
***************
*** 0 ****
--- 1,10 ----
+ /* PR c/12466
+ Test for not warning about ellipsises with -Wold-style-definition. */
+
+ /* Origin: Kelley Cook <kcook@gcc.gnu.org> */
+ /* { dg-do compile } */
+ /* { dg-options "-Wold-style-definition" } */
+
+ void bar1 ( ... ) {} /* { dg-error "ISO C requires a named argument" } */
+
+ void bar2 (int a, ... ) {}
Index: testsuite/gcc.dg/wtr-func-def-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/wtr-func-def-1.c,v
retrieving revision 1.1
diff -c -p -r1.1 wtr-func-def-1.c
*** testsuite/gcc.dg/wtr-func-def-1.c 3 Jul 2002 02:41:34 -0000 1.1
--- testsuite/gcc.dg/wtr-func-def-1.c 1 Oct 2003 23:54:25 -0000
*************** f_impl3(int f)
*** 143,163 ****
return 0;
}
! /* Test that we don't warn about stdarg functions. */
f_stdarg1(const char *s, ...)
! {
return 0;
}
void f_stdarg2(const char *s, ...)
! {
return;
}
extern void f_stdarg3(const char *, ...);
void f_stdarg3(const char *s, ...)
! {
return;
}
--- 143,163 ----
return 0;
}
! /* Test stdarg functions. */
f_stdarg1(const char *s, ...)
! { /* { dg-warning "traditional C rejects ISO C style" } */
return 0;
}
void f_stdarg2(const char *s, ...)
! { /* { dg-warning "traditional C rejects ISO C style" } */
return;
}
extern void f_stdarg3(const char *, ...);
void f_stdarg3(const char *s, ...)
! { /* { dg-warning "traditional C rejects ISO C style" } */
return;
}
More information about the Gcc-patches
mailing list