Why “unused attribute” generated warning for array of struct?

前端 未结 2 1476
挽巷
挽巷 2021-01-14 23:40

Here used, unused attribute with structure.

According to GCC document:

unused :

This attribute, atta

2条回答
  •  执念已碎
    2021-01-14 23:58

    This attribute should be applied on a variable not struct definition. Changing it to

    void func2()
    { 
      __attribute__ ((unused)) struct St s[1];  
    }
    

    will do the job.

提交回复
热议问题