This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is a Better Warning for this Stupid Mistake?
- From: James Dennett <james dot dennett at gmail dot com>
- To: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- Cc: GCC List <gcc at gcc dot gnu dot org>
- Date: Wed, 25 Feb 2009 16:22:27 -0800
- Subject: Re: Is a Better Warning for this Stupid Mistake?
- References: <49A58669.6010800@oarcorp.com>
On Wed, Feb 25, 2009 at 9:56 AM, Joel Sherrill
<joel.sherrill@oarcorp.com> wrote:
> Hi,
>
> I made a stupid typo and accidentally included
> an unprotected file from itself. ?The error
> message generated by gcc surprised me and I
> wondered if there was a better alternative.
>
> $ cat recursive_include.c
> #include "recursive_include.c"
> $ gcc -c recursive_include.c ................
> ? ? ? ? ? ? ? ?from recursive_include.c:1:
> recursive_include.c:1:31: error: #include nested too deeply
> $ gcc -c recursive_include.c 2>&1 | wc -l
> 200
>
> Thanks.
That seems like a pretty good error message to me! We could apepnd "
(possibly recursive #include?)" or similar, but I don't know that
would help. Recursive #include (suitably terminated, of course) is an
unusual but not unheard of implementation technique.
-- James