Re: [PATCH] Fix "identifier redeclared" compilation error with SUN cc.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2007.11.15 20:58:55 -0800, Junio C Hamano wrote:
> How about doing it this way?
> 
>   # ifndef FLEX_ARRAY
>   #   if defined(__GNUC__)
>   #     if (__GNUC__ < 3)
>   #       define FLEX_ARRAY 0
>   #     else
>   #       define FLEX_ARRAY /* empty */
>   #     endif
>   #   else
>         /* more cases we know we can use 0 or empty can come here */
>   #   endif
>   # endif
> 
>   /* if still undefined, default to the safe, old fashioned way */
>   # ifndef FLEX_ARRAY
>   #   define FLEX_ARRAY 1
>   # endif

Yeah, looks a bit smarter.

> The basic idea is:
> 
>  * The user (from Makefile command line, config.mak, or you
>    could add autoconf test) can pass -DFLEX_ARRAY=... to specify
>    exactly what should happen;

Eeeek! He said autoconf! Waaah! ... Ehrm, sorry where was I?

>  * Otherwise, if we happen to know for sure that we can use "0"
>    or "/* empty */" with the compiler, we define FLEX_ARRAY;
>    currently we know such things for gcc.
> 
>  * For everybody else, we use safer default of "1".  IOW, if you
>    know your compiler does not grok "/* empty */" nor "0", you
>    do not have to do anything special but use the default case
>    as everybody else.

Yep, definitely better than my patch.

Björn
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux