This is the mail archive of the gcc@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: Invalid code in <limits>


Phil Edwards <phil@jaj.com> writes:

[...]

| Perhaps we should try to evaluate and fold the expression before diagnosing
| the presence of a function call?
| 
| Perhaps all __builtin_xxx functions which are capable of being in an
| i.c.e. should simply have a certain attribute on them?  The compiler sees
| 
|     const static int foo = ......  fn() ...
| 
| and checks for the attribute on fn; if not there, it's an error.

Builtins are defined with various attributes, among which a bit to
tell that the compiler *do* about the builtin and it is its
responsability to make sense of it:

   /* Like DEF_LIB_BUILTIN, except that the function is expanded in the
      front-end.  */
   #undef DEF_FRONT_END_LIB_BUILTIN                        
   #define DEF_FRONT_END_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS)      \
     DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE,       \
                  true, true, false, ATTRS)


The basic machinery is already there.

-- Gaby


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