[cfe-dev] warning: declaration does not declare anything / error: no member named 'LOW' in 'STRUCT'

Friedman, Eli via cfe-dev cfe-dev at lists.llvm.org
Mon Jul 30 14:06:53 PDT 2018


Adding a separate flag to control this is probably fine. Not sure about 
the name fplan9-extensions; in gcc, I think that includes some other 
extensions we don't implement.

-Eli

On 7/30/2018 12:52 PM, Richard Smith wrote:
> Would it make sense to add a -fplan9-extensions flag, to enable 
> support for this without enabling all the other MS extensions that we 
> support?
>
> On Mon, 30 Jul 2018 at 11:53, Friedman, Eli via cfe-dev 
> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
>
>     On 7/30/2018 9:08 AM, Frank Redeker via cfe-dev wrote:
>     > Hello List,
>     >
>     > Given the following piece of code.
>     >
>     > typedef union {
>     >       struct {
>     >               unsigned char   LOW;
>     >               unsigned char   HIGH;
>     >       };
>     >       unsigned short  SHORT;
>     > } UNION;
>     >
>     > typedef struct {
>     >       UNION; // <-- use of type only
>     >       union {
>     >               unsigned char   FOO;
>     >       };
>     > } STRUCT;
>     >
>     > STRUCT        Variable;
>     >
>     > void Function () {
>     >       Variable.LOW = 1;
>     > }
>     >
>     >
>     > This code compiles without any error using gcc 7.2 (When
>     compiling with
>     > -ansi -pedantic I get the warning "ISO C90 doesn't support unnamed
>     > structs/unions". If I add -std=c11 the warning disappears)
>
>     Declaring an anonymous union like that non-standard; you need to pass
>     -fms-extensions.
>
>     -Eli
>
>     -- 
>     Employee of Qualcomm Innovation Center, Inc.
>     Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
>     a Linux Foundation Collaborative Project
>
>     _______________________________________________
>     cfe-dev mailing list
>     cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180730/9c11358b/attachment.html>


More information about the cfe-dev mailing list