[Development] A modest proposal: disable lower-case keywords (emit, foreach, forever, signals, slots) by default

Jean-Michaël Celerier jeanmichael.celerier at gmail.com
Thu Feb 27 14:22:14 CET 2020


> I may need to write that patch myself.

Would you consider instead a patch introducing a builtin that allows a
library to declare attributes they "support" ?
eg something in the taste of __builtin_declare_valid_attribute("qt::emit");

A far cry from attribute creation abilities of languages such as C#[1] or
Java but
better than nothing.

This way typo detection could happen with [[qt::emitt]] for instance (or
more likely people trying [[Qt::emit]] or [[QT::emit]]).

Best,
Jean-Michaël

[1]:
https://docs.microsoft.com/en-us/dotnet/standard/attributes/writing-custom-attributes


On Thu, Feb 27, 2020 at 1:41 PM Ville Voutilainen <
ville.voutilainen at gmail.com> wrote:

> On Thu, 27 Feb 2020 at 09:15, Alex Blasche <alexander.blasche at qt.io>
> wrote:
>
> > >In general, implementations can still warn about pretty much whatever
> > >they please, especially considering
> > >that their default modes are not strictly conforming.
> > >
> > >The compilers we plan to support in Qt 6 do warn about unknown
> > >attributes, so the allowance point is kinda
> > >theoretical.
> >
> > Ville, please help me understand sth. If the express intention of
> attributes is that users should be encouraged to have their own, aren't the
> warning policies exhibited by current compilers counter productive to the
> intent of their intended purpose? Or do attributes mostly exist for the
> purposes compilers themselves may face?
>
> They are counter-productive, yes. The compilers overreach, see below.
>
> > Also what's the chance that compiler communities might accept Qt
> specific attributes if for example TQtC were to put relevant patches
> forward?
>
> The chance is very good; I talked about this with the maintainer of
> GCC already, and he was amenable to disabling
> an "unknown attribute" warning if the attribute has a namespace. For
> attributes that don't have namespaces,
> diagnosing unknown attributes allows diagnosing typos, so it's
> unlikely that all such warnings would be axed.
>
> I may need to write that patch myself. In any case, such solutions
> don't help GCC 9.x users or users of earlier
> GCC 10.x versions, in case the patch wouldn't hit GCC 10.
>
> I think the chance of success is similarly good with clang; the case
> for not complaining about namespaced
> attributes is fairly clear. But that change isn't something I have
> time to patch into clang. I haven't looked at
> MSVC or other compilers.
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200227/433921f8/attachment.html>


More information about the Development mailing list