kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Why doesn't the GCC give any warning to these unused variables in the Linux kernel?
@ 2022-02-20  7:39 Song Zhi
  2022-02-20  9:09 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Song Zhi @ 2022-02-20  7:39 UTC (permalink / raw)
  To: kernelnewbies@kernelnewbies.org


[-- Attachment #1.1: Type: text/plain, Size: 489 bytes --]

Normally, the compiler warns if a variable is declared but is never referenced. In the Linux kernel source code, some unused functions and variables are marked __atrribute__((unused)).


==> https://livegrep.com/search/linux?q=__attribute__((unused))


GCC, on the other hand, does not provide any warnings for these unused and unmarked variables like the integer flags in kernel/sched/idle.c#427<https://elixir.bootlin.com/linux/latest/source/kernel/sched/idle.c#L427> .


Why?

[-- Attachment #1.2: Type: text/html, Size: 2596 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-20  9:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-20  7:39 Why doesn't the GCC give any warning to these unused variables in the Linux kernel? Song Zhi
2022-02-20  9:09 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).