This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: problem in gcc (lib) headers __BEGIN_DECLS & traceback-incomplete
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: L A Walsh <gcc at tlinx dot org>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 8 Mar 2017 00:26:21 +0000
- Subject: Re: problem in gcc (lib) headers __BEGIN_DECLS & traceback-incomplete
- Authentication-results: sourceware.org; auth=none
- References: <58BF22D2.1090105@tlinx.org> <CAH6eHdR7RP2rEMd1wqT=et7830O_02i_pPkBoSydhDhtH5X-LA@mail.gmail.com> <58BF4EE7.1020701@tlinx.org>
On 8 March 2017 at 00:23, L A Walsh wrote:
> Jonathan Wakely wrote:
>
>> Reduce your code to the minimum necessary to show the problem, and
>> paste that here. If as you say, there is nothing before the includes,
>> you shouldn't need to paste any of your code, just two files
>> containing nothing but include directives. We can't reliably guess
>> what your code does.
>
> ----
>
> Here it is, there is a source error in a .h file, but it and an include of
> '<cassert>' were behind 2-3 levels of includes. In this case, the missing
> '}' is shown immediately after the __BEGIN_DECLS prob, but it wasn't that
> way with all the other includes (if it was shown at all).
>
> So why doesn't it show the missing '}' before the __BEGIN_DECLS error when
> the missing '}' occurs before the include of cassert?
Because it's valid to do:
struct X {
#include "foo.h"
};
Or even:
struct Y {
#include "bar.h"
where the closing brace is in bar.h
So the compiler can't give an error before the include, because the
header might provide the closing brace.