On Sun, 4 May 2014, Nathan Ridge wrote:
GCC 4.9 gives a warning for this program: int main() { int x; } test.cpp: In function 'int main()': test.cpp:3:9: warning: unused variable 'x' [-Wunused-variable] int x; ^ If I add an "unused" attribute with the GNU syntax: int x __attribute__((unused)); the warning goes away. However, if I use the C++11 syntax: int x [[unused]]; the warning remains, and I also get: test.cpp:3:20: warning: 'unused' attribute directive ignored [-Wattributes] int x [[unused]]; ^ Are there plans to support the attributes with C++11 syntax (in terms of having them actually do something)?
Try [[gnu::unused]]. -- Marc Glisse