Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty statements and preprocessor control flow #10

Open
AsFoxy opened this issue Jun 2, 2017 · 3 comments
Open

Empty statements and preprocessor control flow #10

AsFoxy opened this issue Jun 2, 2017 · 3 comments
Assignees
Labels

Comments

@AsFoxy
Copy link

AsFoxy commented Jun 2, 2017

Empty statements are treated as errors:

_x =
{
    ;
};

The error was initially caused by this:

#define DEBUG_LOG_TRACE

#define Debug_Log_Impl(mode, message) (diag_log format ['mode: %1', message])

#ifdef DEBUG_LOG_TRACE
	#define Debug_LogTrace(message) Debug_Log_Impl(TRACE,message)
#else
	#define Debug_LogTrace(message)
#endif

Debug_LogTrace("");

_exit =
{
	endMission "END1";
};

It seems that the preprocessor flow control is ignored, and Debug_LogTrace("") is incorrectly expanded as nothing, creating an empty statement. The empty statement in itself is of course perfectly valid.

@SkaceKamen
Copy link
Owner

I'm unable to replicate this issue. Is it possible it's caused by some code before this statement?

@AsFoxy
Copy link
Author

AsFoxy commented Jun 2, 2017

It seems the problem is actually empty statements i.e.

_x =
{
    ;
};

The error was initially caused by this:

#define DEBUG_LOG_TRACE

#define Debug_Log_Impl(mode, message) (diag_log format ['mode: %1', message])

#ifdef DEBUG_LOG_TRACE
	#define Debug_LogTrace(message) Debug_Log_Impl(TRACE,message)
#else
	#define Debug_LogTrace(message)
#endif

Debug_LogTrace("");

_exit =
{
	endMission "END1";
};

It seems that the preprocessor flow control is ignored, and Debug_LogTrace("") is incorrectly expanded as nothing, creating an empty statement. The empty statement in itself is of course perfectly valid.

@SkaceKamen SkaceKamen added the bug label Jun 2, 2017
@SkaceKamen SkaceKamen self-assigned this Jun 2, 2017
@AsFoxy AsFoxy changed the title Trailing semicolon Empty statements and preprocessor control flow Jun 2, 2017
@SkaceKamen
Copy link
Owner

Oh, that makes sense. #ifdef is not yet supported, but the parser should accept the empty statement.

Could you move the last comment to the top, so it's clear what the issue is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants