This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH RFA: -Wc++-compat warn about typedef/tag conflict
- From: Gabriel Dos Reis <dosreis at gmail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 15 May 2009 14:04:36 -0500
- Subject: Re: PATCH RFA: -Wc++-compat warn about typedef/tag conflict
- References: <m33ab6gpvf.fsf@google.com>
- Reply-to: gdr at integrable-solutions dot net
On Fri, May 15, 2009 at 1:52 PM, Ian Lance Taylor <iant@google.com> wrote:
> In C, struct, union and enum tags occupy a distinct name space. ?In C++,
> these tags are in the same name space as typedef names. ?C++ permits an
> explicit typedef of a tag to the associated type. ?However, it does not
> permit the same name to be used as a tag and a typedef of some other
> type. ?In particular, this is invalid in C++:
> ? ?typedef struct mystruct *mystruct;
>
> The first patch in this message improves -Wc++-compat to warn about
> these cases. ?This patch requires approval from the C frontend
> maintainers.
>
> The second patch in this message fixes the gcc source code so that
> bootstrap succeeds. ?This mechanical patch requires approval from the
> C++ and libcpp maintainers.
OK.
I was wondering whether it would not be simpler to move
the typedef
typedef struct convert_optab_d *convert_optab;
before the definition of convert_optab_d so that you just
use convert_optab as opposed to the more convoluted/verbose
struct convert_optab_d *
in function parameters.