This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add attribute "artificial"


On Sat, 2005-08-06 at 00:27 +0100, Paul Brook wrote:
> > >>> "This attribute is suitable for compiler provided intrinsics headers
> > >>> only".
> > >>
> > >> In that case, why document it externally at all?  If you do, people
> > >> _will_
> > >> misuse it.
> > >
> > > Because if you don't, it's a documentation regression, and people will
> > > look at the header, see the attribute, and try to figure out what it
> > > does...
> >
> > ...and hopefully they won't be able to and will therefore not use it.
> > This is what we want.
> 
> Hahaha. You're kidding, right?

I've tried to explain that poorly documented features just makes users
assume they do what they want them to do, not stop them from using it.
They seem to think i'm just pulling this out of my ass, instead of
having seen it happen for many years in real source code in linux
distros, etc.

IMHO, If you really want a compiler-only attribute, it shouldn't usable
by the user.

Thus, i'm half of the mind that a better approach is simply a table of
function names that should be marked with this new attribute, stored in
the compiler, so that the attribute doesn't have to be visible to the
user at all. You put a space in the attribute so you can't use it from
user code.

This is near how we handle attributes like NOVOPS.

  /* For internal use (marking of builtins) only.  The name contains
space
     to prevent its usage in source code.  */
  { "no vops",                0, 0, true,  false, false,
                              handle_novops_attribute },


You could probably extend the builtins table to note the compiler
intrinsics and their attributes, and just throw this attribute there.

Whether others think this is a better approach than "not documenting"
the attribute, i'm not sure.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]