Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Non-existent semantic errors (after index rebuild and such)

This sounds similar to what is described in bug 413768.  In that case the errors were traced back to a combination of
two features:

1) A performance feature that detects include guards and then processes the header file only one time.
2) A feature that includes all versions of header files.

As a test you could try disabling one or both of these features.  1 can be disabled by changing
IncludeGuardDetection.detectIncludeGuard to return null in all cases.  2 can be changed by editing
PDOMWriter.storeFileInIndex to comment out the following (starts at line 607 in a recent git fetch):

	for (ISignificantMacros sig : stmt.getLoadedVersions()) {
		if (!sig.equals(mainSig)) {
			includeInfos.add(new IncludeInformation(stmt, targetLoc, sig, false));
		}
	}

-Andrew

On 13-09-08 06:04 AM, Alec Teal wrote:
> Hey guys,
> 
> Remember a while back I wanted to work on (or have done) syntax highlighting for grammars (specifically Flex and Bison)
> and by doing it build the ground work for any utilities that mix C(++) and some other way of defining things at compile
> time?
> 
> I started doing that and as first things first I started creating my control, a project which Eclipse either didn't like
> or ignored files of and to go from there.
> 
> I didn't get that far, Eclipse CDT is making up non-existent semantic errors.
> 
> *Prototype:
> 
> *    static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
> 
> *Implementation:*
> 
>     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
> 
> {
> 
> (...)
> 
> *Line with error:
> 
> *    yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
> 
> *Error:
> *Invalid arguments '
> Candidates are:
> void yy_init_buffer(yy_buffer_state *, _IO_FILE *, void *)
> '
> 
> *Typedefs and macros at play:
> 
> *YY_BUFFER_STATE is a yy_buffer_state* - CDT recognises this when I mouse over.
> 
> YY_CURRENT_BUFFER is a macro that gets the current YY_BUFFER_STATE from a stack (array) of them, stored in yy_guts,
> which mousing over shows it's happy with.
> 
> FILE is a typedef of _IO_FILE, Eclipse sees this again
> 
> yyscan_t is a typedef of a void* (usually (read: to the best of my knowledge) a pointer to yy_guts)
> 
> This is a reentrant scanner for those trying to re-create it. Nothing to do either with the actual lexing part, so to
> re-create:
> 
> %option reentrant
> %%
> 
> Is all you need for the grammar. I had the extra option with noyywrap but I've just test this, the error persists
> without (I knew this, for those thinking "why, that wouldn't have made a difference" - I just want you guys to know
> empirically that the error carries on)
> 
> *Lastly:
> *Note that the compiler is fine, -Wall and -Wextra as everyone should (GCC 4.9 from last week) - it gives unused
> function warnings but no errors. CDT correctly marks the warnings with the yellow warning markers.
> 
> I am compiling with --std=c++11, this is not causing the problem though.
> 
> I also include <stdio.h> but (again not surprisingly) with or without the problem persists.
> 
> So you can see this is not a Flex thing, CDT is somehow not recognising the types, even though it does... which is
> weird. This is not a using Flex problem either, everything compiles and runs, /I am not stuck/ - this is about
> fabricating semantic errors. It ought not be specific to flex.
> 
> (there are 3 errors it picks up, this details one, all 3 are not actually errors - I've created text-code that even uses
> the functions these 'error' functions have call-sites in just in case that'd change anything, I've rebuilt the index and
> rescanned, I've restarted the workspace....
> 
> Eclipse 4.2 with the latest CDT that can be installed from the default update site.
> 
> Alec
> 
> 
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 



Back to the top