[Qt-creator] Use #pragma once as default instead of header guards

Nikolai Kosjar nikolai.kosjar at theqtcompany.com
Wed Jan 13 15:22:38 CET 2016


On 01/13/2016 01:52 PM, Joerg Bornemann wrote:
> Still, as it came up, this argument raises the interesting question what
> will happen to users of the clang code model that cannot switch to
> (non-standard) pragma once for this or that reason?
>
> What would it take to fix this problem? Can we work around it? Can we
> provide an upstream fix?

A fix from Erik is pending for review at http://reviews.llvm.org/D15994 
, but so far there were no comments.

> Apart from that, I did not understand the problem at all.
> The opening #ifndef does match the #endif, doesn't it?
> If "matches" means "is balanced with" at least.

As far as I understand:

The preamble includes everything up to the very first declaration (not 
including it). Now the rule seems to be that a preamble is only 
generated if the preprocessor conditions are balanced *within* the 
preamble. In the given example #ifndef is in the preamble region, but 
not #endif.

Nikolai



More information about the Qt-creator mailing list