https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103165

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:a6e0d593707ae44dec0bdf2bcdc4f539050b46db

commit r12-5454-ga6e0d593707ae44dec0bdf2bcdc4f539050b46db
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Mon Nov 22 22:29:20 2021 +0100

    libcpp: Fix _Pragma stringification [PR103165]

    As the testcase show, sometimes _Pragma is turned into CPP_PRAGMA
    .. CPP_PRAGMA_EOL tokens, even when it might still need to be
    stringized later on.  We are then ICEing because we don't handle
    stringification of CPP_PRAGMA or CPP_PRAGMA_EOL, but trying to
    reconstruct the exact tokens with exact spacing after it has been
    lowered is very hard.  So, instead this patch ensures we don't
    lower _Pragma during expand_arg calls, but only later when
    cpp_get_token_1 is called outside of expand_arg.

    2021-11-22  Jakub Jelinek  <ja...@redhat.com>
                Tobias Burnus  <tob...@codesourcery.com>

            PR preprocessor/103165
    libcpp/
            * internal.h (struct lexer_state): Add ignore__Pragma field.
            * macro.c (builtin_macro): Don't interpret _Pragma if
            pfile->state.ignore__Pragma.
            (expand_arg): Temporarily set pfile->state.ignore__Pragma to 1.
    gcc/testsuite/
            * c-c++-common/gomp/pragma-3.c: New test.
            * c-c++-common/gomp/pragma-4.c: New test.
            * c-c++-common/gomp/pragma-5.c: New test.

    Co-Authored-By: Tobias Burnus <tob...@codesourcery.com>

Reply via email to