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: Preliminary mainline patch for __attribute__ ((sentinel))


On Sat, 28 Aug 2004, Kaveh R. Ghazi wrote:

> Hmm, it looks like GCC's stddef.h is more aggresive in insisting on
> it's own definition of NULL than I realized.  It undef's the old one
> rather than doing an ifndef check.  So as long as stddef.h is
> included, in any order relative to other headers, you'll get the GCC
> preferred definition of (void*)0.  So I don't see a need to insist on
> my position.
> 
> This version of the patch only accepts a pointer zero.
> Are there any further issues or is this one okay?

This looks reasonable (though the testcases are needed to judge properly).  
(Refinements such as handling with -pedantic and -Wno-format-extra-args 
are clearly something to leave for possible future patches.)  You haven't 
updated the documentation to take account of only accepting pointer types.

The integer definition of NULL used for C++ means that people making GCC 
compile as C++ will need to change the calls to concat after all.  I think 
this should be considered just part of the extra casts needed because of 
C++'s greater type safety, and that C++ users will have a greater 
expectation than C users of needing to cast to the proper pointer type.  
(And many C++ users may prefer to use 0, appropriately cast where 
necessary, rather than NULL anyway.)

> +	  if (! POINTER_TYPE_P (TREE_TYPE (value)) || ! integer_zerop (value))

The coding convention is no space after "!", as elsewhere in your patch, 
though the existing code is not yet consistent.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


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