Re: [PATCH 00/11] pragma once: treewide conversion

2021-03-23 Thread Pavel Machek
Hi! > > > (a) the traditional include guard optimization HAS NO HIDDEN SEMANTIC > > > MEANING. It's a pure optimization that doesn't actually change > > > anything else. If you don't do the optimization, absolutely nothing > > > changes. > > > > And if the parser is well written the optimisation

Re: [PATCH 00/11] pragma once: treewide conversion

2021-03-06 Thread Linus Torvalds
On Sat, Mar 6, 2021 at 5:07 AM Miguel Ojeda wrote: > > Concerning #pragma once: I actually would like to have a standard > #once directive if what is a "seen file" could be defined a bit more > precisely. I think it would be ok if you had something like #pragma once IDTOKEN which would basic

Re: [PATCH 00/11] pragma once: treewide conversion

2021-03-06 Thread Miguel Ojeda
On Fri, Mar 5, 2021 at 10:25 PM Linus Torvalds wrote: > > And regardless of even _those_ issues, you still should do all the > other syntactic tokenization stuff (ie all the quoting, the the > character handling: 'a' is a valid C token, but if you see the string > "it's" outside of a comment, that

Re: [PATCH 00/11] pragma once: treewide conversion

2021-03-05 Thread Linus Torvalds
On Fri, Mar 5, 2021 at 1:19 AM David Laight wrote: > > The point is that you can skip the unwanted parts of > #if without having to parse the file at all. > You just need to detect the line breaks. That's not actually true AT ALL. You still need to at the very least parse the preprocessor tokens

RE: [PATCH 00/11] pragma once: treewide conversion

2021-03-05 Thread David Laight
From: Linus Torvalds > Sent: 04 March 2021 20:16 > > On Thu, Mar 4, 2021 at 5:55 AM David Laight wrote: > > > > > (a) the traditional include guard optimization HAS NO HIDDEN SEMANTIC > > > MEANING. It's a pure optimization that doesn't actually change > > > anything else. If you don't do the op

Re: [PATCH 00/11] pragma once: treewide conversion

2021-03-04 Thread Linus Torvalds
On Thu, Mar 4, 2021 at 5:55 AM David Laight wrote: > > > (a) the traditional include guard optimization HAS NO HIDDEN SEMANTIC > > MEANING. It's a pure optimization that doesn't actually change > > anything else. If you don't do the optimization, absolutely nothing > > changes. > > And if the par

RE: [PATCH 00/11] pragma once: treewide conversion

2021-03-04 Thread David Laight
> (a) the traditional include guard optimization HAS NO HIDDEN SEMANTIC > MEANING. It's a pure optimization that doesn't actually change > anything else. If you don't do the optimization, absolutely nothing > changes. And if the parser is well written the optimisation is probably irrelevant compa

Re: [PATCH 00/11] pragma once: treewide conversion

2021-03-03 Thread Linus Torvalds
On Wed, Mar 3, 2021 at 11:46 AM Tom Tromey wrote: > > It's also worth noting that in GCC it is slower than include guards. > See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58770 > > It's just a bug, probably easy to fix. On the other hand, nobody has > ever bothered to do so. That bugzilla is

Re: [PATCH 00/11] pragma once: treewide conversion

2021-02-28 Thread Luc Van Oostenryck
On Sun, Feb 28, 2021 at 10:34:46PM +0300, Alexey Dobriyan wrote: > > gcc does > > open "/" + "whatever between quotes" > fstat > > so that "1.h" and "./1.h" differ When I try the following with GCC 10.2: $ cat header.h #pragma once #include "./header.h"

Re: [PATCH 00/11] pragma once: treewide conversion

2021-02-28 Thread Linus Torvalds
On Sun, Feb 28, 2021 at 11:34 AM Alexey Dobriyan wrote: > > > > > End result: #pragma is fundamentally less reliable than the > > traditional #ifdef guard. The #ifdef guard works fine even if you > > re-read the file for whatever reason, while #pragma relies on some > > kind of magical behavior.

Re: [PATCH 00/11] pragma once: treewide conversion

2021-02-28 Thread Alexey Dobriyan
On Sun, Feb 28, 2021 at 09:46:17AM -0800, Linus Torvalds wrote: > On Sun, Feb 28, 2021 at 8:57 AM Alexey Dobriyan wrote: > > > > This is bulk deletion of preprocessor include guards and conversion > > to #pragma once directive. > > So as mentioned earlier, I'm not 100% convinced about the advanta

Re: [PATCH 00/11] pragma once: treewide conversion

2021-02-28 Thread Linus Torvalds
On Sun, Feb 28, 2021 at 8:57 AM Alexey Dobriyan wrote: > > This is bulk deletion of preprocessor include guards and conversion > to #pragma once directive. So as mentioned earlier, I'm not 100% convinced about the advantage of #pragma once. But I decided to actually test it, and it turns out tha

[PATCH 00/11] pragma once: treewide conversion

2021-02-28 Thread Alexey Dobriyan
This is bulk deletion of preprocessor include guards and conversion to #pragma once directive. See [PATCH 11/11] and [PATCH 12/11] for the script and rationale. Everything else is trivial stuff.