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

Reply via email to