[PATCH] Improved diagnostics for casts and enums

Nathan Sidwell nathan@acm.org
Thu Apr 27 12:37:00 GMT 2017


On 04/27/2017 03:29 AM, Volker Reichelt wrote:
> Hi,
> 
> the following two patches aim at improving GCC's diagnostics to help
> the user to get rid of old-style casts. While old-style pointer casts
> are really bad and need to be weeded out quickly, old-style casts between
> arithmetic types are IMHO much more tolerable. The patches allow to
> easily distinguish between those situations.
> 
> The first patch for cp_parser_cast_expression in parser.c just adds
> the target type of the cast to the diagnostic (like in
> maybe_warn_about_useless_cast in typeck.c).
> 
> The second patch for type_to_string in error.c tackles the problem
> that the name of a type doesn't tell you if you have a class or just
> a simple enum. Similar to adding "{aka 'int'}" to types that
> are essentially integers, this patch adds "{enum}" to all
> enumeration types (and adjusts two testcases accordingly).
> 
> Bootstrapped and regtested on x86_64-pc-linux-gnu.
> 
> OK for trunk (as two patches or as one)?

ok.  One commit is fine.

nathan

-- 
Nathan Sidwell



More information about the Gcc-patches mailing list