lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 14 Jun 2024 09:29:33 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, linux-security-module@...r.kernel.org,
	linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH] linux++: delete some forward declarations

On Thu, Jun 13, 2024 at 04:10:12PM -0400, Steven Rostedt wrote:
> On Thu, 13 Jun 2024 13:04:20 -0700
> Andrew Morton <akpm@...ux-foundation.org> wrote:
> 
> > On Thu, 13 Jun 2024 15:34:02 -0400 Steven Rostedt <rostedt@...dmis.org> wrote:
> > 
> > > On Thu, 13 Jun 2024 22:22:18 +0300
> > > Alexey Dobriyan <adobriyan@...il.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?

With out-of-tree patch, yes.

What happens is that "enum E;" works in C but doesn't work in C++.
The fix (in C++) is to either delete, or change to "enum E:int;".

The same applies to

	const struct S s;
	const struct S s = {};

First declaration is compile error in C++, sometimes it can be deleted.

This patch is some "unused" parts merged together because it doesn't
make sense to split this much -- every chunk is independent of each
other.

> > > I would make that a separate patch.  
> > 
> > What are you referring to here?
> 
> The enum change should be separate from the struct changes.
> 
> > 
> > > > 
> > > > 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.
> 
> eh

Steven is right. That's what my literature teacher said in high school.

> > 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.
> 
> Well, I only looked at the one change in ftrace.h which has a
> "struct seq_file;" that is not used anywhere else in the file, so that
> one definitely can go.

It was tested on arm64 allmodconfig too.

OK if this is concern, I could dust off my compile test farm.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ