Here used, unused
attribute with structure.
According to GCC document:
unused :
This attribute, attached to a variable, means that the variable is meant to be possibly unused. GCC will not produce a warning for this variable.
But, In the following code, array of struct generated warning.
#include <stdio.h>
struct __attribute__ ((unused)) St
{
int x;
};
void func1()
{
struct St s; // no warning, ok
}
void func2()
{
struct St s[1]; // Why warning???
}
int main() {
func1();
func2();
return 0;
}
Why does GCC generated warning for array of struct?