[9] RFR(L): 8037816 : Fix for 8036122 breaks build with Xcode5/clang

Christian Thalinger christian.thalinger at oracle.com
Fri Apr 18 00:01:09 UTC 2014


On Apr 17, 2014, at 1:31 PM, David Chase <david.r.chase at oracle.com> wrote:

> 
> On 2014-04-17, at 6:26 PM, Christian Thalinger <christian.thalinger at oracle.com> wrote:
>> 
>> + #if defined(__clang_major__) || (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6)
>> Do all versions of Clang support push and pop?
> 
> I don't know -- what versions of clang are we likely to use?

The most likely ones are 4.2, 5.0, and 5.1 but there is also a comment in the makefiles mentioning 3.1:

  # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm'

> 
>>> (3) In many cases, the best fix is to replace a call to a method expecting a format with one to a method expecting only a string.  That is, replace “print(s)” with “print_raw(s)”.  Note that when there is a single parameter this cannot possibly be a mistake.
>> 
>> Yes, it fixes the problem but it will be difficult to remember or know (for new people) that you should use print_raw instead.
> 
> What's the alternative?  Once we get our compilers up to decent revisions, the checking will just be there, and
> anyone who writes print(s) will get an error.

Not sure.  Can we make:

   void print_raw(const char* str)            { write(str, strlen(str)); }

just

   void print(const char* str)            { write(str, strlen(str)); }

?  That would help a lot, I think.

> 
> The reason I used "print_raw" was that it was already there, and it was the least-violence change to the code;
> no need to insert "%s", before the string, etc.  "raw" makes it sound sort of unsafe, but it's the moral equivalent of puts(s).
> 
> 
>>> (4) Use new P2I macro to clean up some of the Linux format warnings; this was feasible for some of the printf-like internal methods that were not called too often with technically-mismatched types and format specifiers.
>>> #define P2I(p) ((intptr_t)(p))
>> 
>> Can we please not use a macro for this?  Use an inline method instead.
> 
> Will do.  What does a top-level inline method look like?
> Would this do?
> 
> static inline intptr_t p2i(void * p) { return (intptr_t) p; }

Yes, thanks.

> 
> David



More information about the hotspot-dev mailing list