[PATCH] linux++: delete some forward declarations

Andrew Morton akpm at linux-foundation.org
Thu Jun 13 20:04:20 UTC 2024


On Thu, 13 Jun 2024 15:34:02 -0400 Steven Rostedt <rostedt at goodmis.org> wrote:

> On Thu, 13 Jun 2024 22:22:18 +0300
> Alexey Dobriyan <adobriyan at gmail.com> wrote:
> 
> > g++ doesn't like forward enum declarations:
> > 
> > 	error: use of enum ‘E’ without previous declaration
> > 	   64 | enum E;
> 
> But we don't care about g++. Do we?

It appears that g++ is a useful enum declaration detector.

I'm curious to know how even the above warning was generated.  Does g++
work at all on Linux?

> I would make that a separate patch.

What are you referring to here?

> > 
> > Delete those which aren't used.
> > 
> > Delete some unused/unnecessary forward struct declarations for a change.
> 
> This is a clean up, but should have a better change log. Just something
> simple like:
> 
>   Delete unnecessary forward struct declarations.

Alexey specializes in cute changelogs.

I do have a concern about the patch: has it been tested with all
possible Kconfigs?  No.  There may be some configs in which the forward
declaration is required.

And...  I'm a bit surprised that forward declarations are allowed in C.
A billion years ago I used a C compiler which would use 16 bits for
an enum if the enumted values would fit in 16 bits.  And it would use 32
bits otherwise.  So the enumerated values were *required* for the
compiler to be able to figure out the sizeof.  But it was a billion
years ago.



More information about the Linux-security-module-archive mailing list