Bug 89978 - nine_state.c:1440: error: unknown field ‘m’ specified in initializer
Summary: nine_state.c:1440: error: unknown field ‘m’ specified in initializer
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: 10.5
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-10 19:40 UTC by Vinson Lee
Modified: 2015-09-28 00:58 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
0001-st-nine-require-gcc-4.6.patch (948 bytes, patch)
2015-04-10 22:15 UTC, David Heidelberg (okias)
Details | Splinter Review

Description Vinson Lee 2015-04-10 19:40:49 UTC
mesa: 50db8bd1b5942a6577ab5ee399cae460fde761d4 (master 10.6.0-devel)

Build error with older GCC.

nine_state.c:1440: error: unknown field ‘m’ specified in initializer

  CC     nine_state.lo
nine_state.c: In function ‘nine_state_access_transform’:
nine_state.c:1440: error: unknown field ‘m’ specified in initializer
nine_state.c:1440: warning: missing braces around initializer
nine_state.c:1440: warning: (near initialization for ‘Identity.<anonymous>.<anonymous>’)
nine_state.c:1441: error: unknown field ‘m’ specified in initializer
nine_state.c:1441: error: extra brace group at end of initializer
nine_state.c:1441: error: (near initialization for ‘Identity’)
nine_state.c:1441: warning: excess elements in struct initializer
nine_state.c:1441: warning: (near initialization for ‘Identity’)
nine_state.c:1442: error: unknown field ‘m’ specified in initializer
nine_state.c:1442: error: extra brace group at end of initializer
nine_state.c:1442: error: (near initialization for ‘Identity’)
nine_state.c:1442: warning: excess elements in struct initializer
nine_state.c:1442: warning: (near initialization for ‘Identity’)
nine_state.c:1443: error: unknown field ‘m’ specified in initializer
nine_state.c:1443: error: extra brace group at end of initializer
nine_state.c:1443: error: (near initialization for ‘Identity’)
nine_state.c:1443: warning: excess elements in struct initializer
nine_state.c:1443: warning: (near initialization for ‘Identity’)


Introduced with 10.5.0-devel commit fdd96578ef2dfe9c4ad5aab5858036298d444a64.

commit fdd96578ef2dfe9c4ad5aab5858036298d444a64
Author: Joakim Sindholt <opensource@zhasha.com>
Date:   Thu Aug 4 15:14:06 2011 +0200

    nine: Add state tracker nine for Direct3D9 (v3)
    
    Work of Joakim Sindholt (zhasha) and Christoph Bumiller (chrisbmr).
    DRI3 port done by Axel Davy (mannerov).
    
    v2: - nine_debug.c: klass extended from 32 chars to 96 (for sure) by glennk
        - Nine improvements by Axel Davy (which also fixed some wine tests)
        - by Emil Velikov:
         - convert to static/shared drivers
         - Sort and cleanup the includes
         - Use AM_CPPFLAGS for the defines
         - Add the linker garbage collector
         - Restrict the exported symbols (think llvm)
    
    v3: - small nine fixes
        - build system improvements by Emil Velikov
    
    v4: [Emil Velikov]
       - Do no link against libudev. No longer needed.
    
    Acked-by: Jose Fonseca <jfonseca@vmware.com>
    Reviewed-by: Marek Olšák <marek.olsak@amd.com>
    Reviewed-by: Axel Davy <axel.davy@ens.fr>
    Signed-off-by: David Heidelberg <david@ixit.cz>
Comment 1 David Heidelberg (okias) 2015-04-10 21:33:06 UTC
Can you provide which one gcc version is latest working?
Comment 2 David Heidelberg (okias) 2015-04-10 22:15:39 UTC
Created attachment 115012 [details] [review]
0001-st-nine-require-gcc-4.6.patch

This is clearly GCC bug[1], should be fixed since GCC 4.6 which every sane X86 & X86_64 distribution will use.

Personally I don't see any reason to fix it differently, than raise configure.ac requirement for Nine to >= gcc 4.6.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676
Comment 3 Emil Velikov 2015-04-12 15:29:58 UTC
(In reply to David Heidelberg (okias) from comment #2)
> Created attachment 115012 [details] [review] [review]
> 0001-st-nine-require-gcc-4.6.patch
> 
> This is clearly GCC bug[1], should be fixed since GCC 4.6 which every sane
> X86 & X86_64 distribution will use.
> 
Just because there is a bug opened about it with GCC that does not make it a GCC bug :-\ The code is using C11 functionality so it's hard to blame the compiler considering that we use -std=c99

> Personally I don't see any reason to fix it differently, than raise
> configure.ac requirement for Nine to >= gcc 4.6.
> 
> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676
>
Imho a better solution would be to add -fms-extensions to the CFLAGS. This will enable anonymous struct/unions and keep things working for pre 4.6 versions of GCC.
Comment 4 David Heidelberg (okias) 2015-04-14 17:42:51 UTC
(In reply to Emil Velikov from comment #3)
> Imho a better solution would be to add -fms-extensions to the CFLAGS. This
> will enable anonymous struct/unions and keep things working for pre 4.6
> versions of GCC.

1. All developers working on Nine using GCC 4.7 and later, users also don't complain (irc logs, google search for error message). This bug is based on theoretical test with old gcc, but in real-life no one triggered it yet (that's why I did proposed patch, to patch this corner case).

Also there is possibility it's not only one problem which will be triggered by older gcc version (maybe not at this moment, but later and will have to workaround it again).

Is chance that real user will compile Nine with something older than GCC 4.6 ? Even Ubuntu 12.04 has 4.6.3 (3 years old + there is no problem updating to 4.7 and later).
Comment 5 David Heidelberg (okias) 2015-04-14 17:46:08 UTC
(In reply to Emil Velikov from comment #3)
> Imho a better solution would be to add -fms-extensions to the CFLAGS. This
> will enable anonymous struct/unions and keep things working for pre 4.6
> versions of GCC.

I'm sorry, you're correct, I missed that part about C11 feature. Well, I'm open to adding -fms-extensions .
Comment 6 Emil Velikov 2015-04-14 21:46:02 UTC
You are correct on the part that pre 4.6 is old and barely widely used. Although as the change is trivial, it might be good to be nice for the extra 1-2 users that might be using it :)

After all the decision is between you and Axel to make.
Comment 7 Vinson Lee 2015-09-28 00:58:00 UTC
commit 56717c0b069a20b0c4438ac1dc9280cd9026b36f
Author: David Heidelberg <david@ixit.cz>
Date:   Sat Apr 11 00:13:53 2015 +0200

    st/nine: Require gcc >= 4.6
    
    Nine code uses some C11 features, and this
    leads to compile error on gcc <= 4.5
    
    Another way would have been to use the
    -fms-extensions CFLAG
    
    Signed-off-by: David Heidelberg <david@ixit.cz>
    Cc: "10.4 10.5 10.6" <mesa-stable@lists.freedesktop.org>


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.