[Development] Using '#pragma once' instead of include guards?
Alexandru Croitor
alexandru.croitor at qt.io
Tue Mar 5 11:59:29 CET 2024
> On 5. Mar 2024, at 11:43, Volker Hilsheimer via Development <development at qt-project.org> wrote:
>
>> On 4 Mar 2024, at 15:56, Kai Köhne via Development <development at qt-project.org> wrote:
>>
>> Hi Marc,
>>
>> I've nothing against using '#pragma once' for private/internal headers.
>>
>> But you said you mainly want to have this to differentiate between different types of headers. If this is the motivation, I think we can make this differentiation even more explicit. For instance, public headers could get a
>>
>> // This header is part of the public Qt API.
>>
>> comment. Much like the 'We mean it', or 'pragma once', syncqt could enforce this for public headers, and error out if it's used for non-public ones.
>>
>> Kai
>
>
>
> I think the challenge then is again how syncqt can know what a public header is. How does syncqt know that src/plugins/**/*.h headers are not public headers? They look like public headers, except for the “plugins” in the path. How do we, on a build system level, distinguish between “private installed” and “private non-installed” headers?
Currently syncqt is only run for modules, not plugins.
So on the build system level, syncqt is only run for qt_internal_add_module calls, and thus doesn't care about any headers that are not attached to a qt module.
More information about the Development
mailing list