Summary: | net-p2p/ghostwhitecrab fails to build with gcc 4.5 | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Diego Elio Pettenò (RETIRED) <flameeyes> |
Component: | New packages | Assignee: | Gentoo TreeCleaner Project <treecleaner> |
Status: | RESOLVED FIXED | ||
Severity: | normal | Keywords: | PMASKED |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | Pending removal: 2011-06-22 | ||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 296658, 357479 | ||
Attachments: | Build log |
Description
Diego Elio Pettenò (RETIRED)
2010-06-01 11:47:15 UTC
Created attachment 233773 [details]
Build log
I am trying to fix this bug 2 days ago without luck I narrow down the error to this piece of code #define STATIC_ASSERT_PLAIN(x) sizeof(char[{(x) ? 1 : -23}] typedef struct { int x[ STATIC_ASSERT_PLAIN(SIZEOF_CHAR == sizeof(signed char)) ... ... ... ]; }; If you replace the #define preprocessor with #define STATIC_ASSERT_PLAIN(x) 4 e.g it works as expected. While the MACRO seems fine to me somehow gcc-4.5 doesn't like that and complains about -> error: Variably modified 'x' at file scope Diego, do you have any thoughts about this kind of error? Based on the name, the macro is meant to perform a build time check that the argument passed to it meets some particular requirement. If the requirement is not met, the package will fail to compile. This is preferable to a runtime assert, where the user would need to execute the program before it failed. The way in which it implements the check down inside a structure is a bit strange. The typical implementation of a static assert is: #define STATIC_ASSERT(X) typedef char __static_assert[(X) ? 1 : -1]; STATIC_ASSERT(sizeof(long) == 4); // works on i686, fails on x86_64 When this snippet is built for x86, it defines a useless but harmless typedef. When it is built on amd64, it fails with the message: error: size of array '__static_assert' is negative It is likely that the ghostwhitecrab code could be rewritten to place the static assertion at global scope near the structure and give the structure member a simple definition, as you did when you defined the macro to a constant number. [Thanks to Ryan for drawing attention to the tracker bug via the October 5th mail on gentoo-dev. I would have missed this bug otherwise.] CC treecleaners because this fails to build with gcc-4.5, and gcc-4.5 tracker is now closed. The time to fix the package is up. It's now targeted for removal as abandoned. gone |