By default, this warning is suppressed in system headers. The code in <sys/queue.h>
is considered to come from a system header because sys/queue.h was found by searching a path marked as containing system headers.
So in (2) you see the warning because it is generated within your code, while in (1) the warning is generated within queue.h, and so is suppressed. Add -Wsystem-headers
to your compilation options, and you'll see the warning in both cases.