This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-Wpedantic does not warn on use of __auto_type
- From: Prathamesh Kulkarni <bilbotheelffriend at gmail dot com>
- To: gcc <gcc at gcc dot gnu dot org>
- Date: Sat, 18 Jan 2014 19:31:59 +0530
- Subject: -Wpedantic does not warn on use of __auto_type
- Authentication-results: sourceware.org; auth=none
Should -Wpedantic warn on use of __auto_type ?
For example, should it warn in the following case ?
int main()
{
__auto_type x = 3;
return 0;
}
I feel so, since __auto_type is non-standard. If it should warn, is
the following fix correct ? I ran the above code snippet (with the fix
applied) and -Wpedantic warned:
/home/bilbo/a.c: In function ‘main’:
/home/bilbo/a.c:3:3: warning: __auto_type is a GNU extension [-Wpedantic]
__auto_type x = 3;
^
Index: c-parser.c
==============================
=====================================
--- c-parser.c (revision 206618)
+++ c-parser.c (working copy)
@@ -2288,6 +2288,7 @@ c_parser_declspecs (c_parser *parser, st
c_parser_consume_token (parser);
break;
case RID_AUTO_TYPE:
+ pedwarn (c_parser_peek_token (parser)->location, OPT_Wpedantic,
"__auto_type is a GNU extension");
if (!auto_type_ok)
goto out;
/* Fall through. */
Thanks and Regards,
Prathamesh