gskslpreprocessor: Error if #endif is missing

This commit is contained in:
Benjamin Otte
2017-10-25 21:21:38 +02:00
parent 651b5bb9b6
commit 5bb7c2ecc3
3 changed files with 21 additions and 0 deletions

View File

@@ -295,6 +295,15 @@ gsk_sl_preprocessor_append_token (GskSlPreprocessor *preproc,
return;
}
if (gsk_sl_token_is (&pp->token, GSK_SL_TOKEN_EOF))
{
while (gsk_sl_preprocessor_has_conditional (preproc))
{
gsk_sl_preprocessor_pop_conditional (preproc);
gsk_sl_preprocessor_error_full (preproc, PREPROCESSOR, &pp->location, "Missing #endif.");
}
}
if (gsk_sl_preprocessor_in_ignored_conditional (preproc))
{
gsk_sl_preprocessor_clear_token (pp);

View File

@@ -0,0 +1,6 @@
#if 0
void
main ()
{
}

View File

@@ -0,0 +1,6 @@
#if 1
void
main ()
{
}