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: Fix for PR/13358


Jack Lloyd <lloyd@randombit.net> writes:

> I would really like to see this PR fixed before 3.4, it is (AFAIK) a 
> one-line change, in gcc/c-lex.c::interpret_integer:
> 
>   if (itk > itk_unsigned_long
>       && (flags & CPP_N_WIDTH) != CPP_N_LARGE
>       && ! in_system_header && ! flag_isoc99)
> 
> to:
> 
>   if (warn_long_long && itk > itk_unsigned_long
>       && (flags & CPP_N_WIDTH) != CPP_N_LARGE
>       && ! in_system_header && ! flag_isoc99)
> 
> Background: GCC 3.3/3.4 rejects long long constants in C++ that don't have
> a LL/ULL suffix. Earlier GCCs (and most other compilers) silently accept
> them. Constants of this type are legal in C99. Given that long long doesn't
> exist in ISO C++, I would think the most logical way for them to be treated
> in C++ is the same as C99. The Bugzilla page has more discussion on this.
> 
> The only (intended) effect is that if -Wno-long-long is used, then long
> long constants without a suffix will be accepted by the C/C++ compiler (in
> 3.3/current 3.4, C will warn and C++ will error). Since -Wlong-long is the
> default this should not affect anyone except users of -Wno-long-long (who
> presumably know what they're getting when they use it).
> 
> Does this seem like a workable fix? And if so, can someone make the change?

Note that the diagnostic is required in ISO C++ for constants that
aren't decimal, so this should probably key off -pedantic (which is on
by default, so the diagnostic should be produced by default) for the
case of octal and hex constants.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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