[PATCH] Define _LLP64 for appropriate targets

Richard Guenther richard.guenther@gmail.com
Wed Aug 19 11:45:00 GMT 2009


On Wed, Aug 19, 2009 at 10:14 AM, Ozkan Sezer<sezeroz@gmail.com> wrote:
> The attached patch makes gcc to define _LLP64 and __LLP64__ for
> targets such as _WIN64.  This would make life easier especially
> for the testsuite where there is the check_effective_target_llp64
> for target requirements but no cpp predefined macro for typedefs,
> etc.  OK for mainline (and 4.4 branch)?
> (I don't have svn access.)
> (also attaching the patch in case gmail mangles whitespace.)

Do these macros follow what MSVC maybe defines on win64?
Are there other LLP64 targets where the vendor compiler has
such definitions?

Richard.


> 2009-08-19  Ozkan Sezer  <sezeroz@gmail.com>
>
>        * c-cppbuiltin.c: Define LLP64 builtins for LLP64 targets such as
>        _WIN64.
>        * * doc/cpp.texi (Common Predefined Macros): Document __LLP64__ and
>        _LLP64.
>
>
> --- gcc/c-cppbuiltin.c~ 2009-01-18 18:26:26.000000000 +0200
> +++ gcc/c-cppbuiltin.c  2009-08-19 10:05:02.000000000 +0300
> @@ -629,6 +629,15 @@ c_cpp_builtins (cpp_reader *pfile)
>       cpp_define (pfile, "__LP64__");
>     }
>
> +  /* Definitions for LLP64 model.  */
> +  if (TYPE_PRECISION (long_integer_type_node) == 32
> +      && POINTER_SIZE == 64
> +      && TYPE_PRECISION (integer_type_node) == 32)
> +    {
> +      cpp_define (pfile, "_LLP64");
> +      cpp_define (pfile, "__LLP64__");
> +    }
> +
>   /* Other target-independent built-ins determined by command-line
>      options.  */
>   if (optimize_size)
> --- gcc/doc/cpp.texi~   2008-08-05 20:24:37.000000000 +0300
> +++ gcc/doc/cpp.texi    2009-08-19 10:03:23.000000000 +0300
> @@ -2212,6 +2212,12 @@ These macros are defined, with value 1,
>  is for a target where @code{long int} and pointer both use 64-bits and
>  @code{int} uses 32-bit.
>
> +@item __LLP64__
> +@itemx _LLP64
> +These macros are defined, with value 1, if (and only if) the compilation
> +is for a target where pointer use 64-bits and @code{int} and @code{long int}
> +both use 32-bit.
> +
>  @item __SSP__
>  This macro is defined, with value 1, when @option{-fstack-protector} is in
>  use.
>



More information about the Gcc-patches mailing list