Diego Novillo wrote:
Given
void foo(void) __attribute__((user("bleh")));
GCC will complain
foo.cc:1: warning: 'user' attribute directive ignored
whenever dehydra is not loaded.
I am surprised & delighted that Diego mentions Dehydra. I thought it was
Taras Glek's plugin, so Mozilla (not Google) related. I even silently
dream that in a few years (or months) Diego would try melt.so - just an
innocent dream...
Diego, feel free to not answer to my curiosity if you don't want...
Since our build system uses -Werror
for every build, users are not really able to use this attribute in
their dehydra scripts. Has anyone run into this? I have suggested
guarding the attribute with a special macro and define that macro
every time they use dehydra, but that's awkward.
I thought that plugin can register attributes which are not even named
"user" but whose name is arbitrary. And I strongly believe it should be
so, because plugin foo.so could handle attribute "foogreen" & "fooblue"
& plugin bar.so could handle attribute "barbarian" [Sorry, I couldn't
resist that stupid joke].
We could change the compiler to never complain about the 'user'
attribute, unless plugins are loaded,but that also seems incomplete.
Compiling with -Wno-attributes helps, but that turns off all
attributes. Perhaps we could control warnings on the 'user' attribute
with a new -Wuser-attribute?
I have a simpler suggestion:
every attribute whose name starts with an underscore like "_user" or
"_foogreen" or "_BORING" never produce any warnings, except perhaps in
the plugin handling it.
Implementing such a convention would be simple. But it has to be
documented, not only in GCC internals, but also in GCC users, language
extension chapter.
Regards.
PS if the dev-static-analy...@lists.mozilla.org list is low volume, I
would like to subscribe if possible.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***