public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/57824] New: Raw string literals not handled correctly in macro arguments or deferred pragmas
@ 2013-07-04 17:21 jakub at gcc dot gnu.org
  2013-07-10 17:43 ` [Bug preprocessor/57824] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-07-04 17:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824

            Bug ID: 57824
           Summary: Raw string literals not handled correctly in macro
                    arguments or deferred pragmas
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: jakub at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
                CC: tromey at gcc dot gnu.org

#define S(s) s

const char x[] = R"(
abc
)";
const char y[] = S(R"(
abc
)");

void bar ();
void foo ()
{
#pragma omp parallel num_threads(sizeof R"(
abc
)")
  bar ();
}

isn't lexed properly.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/57824] Raw string literals not handled correctly in macro arguments or deferred pragmas
  2013-07-04 17:21 [Bug preprocessor/57824] New: Raw string literals not handled correctly in macro arguments or deferred pragmas jakub at gcc dot gnu.org
@ 2013-07-10 17:43 ` jakub at gcc dot gnu.org
  2013-08-13 17:03 ` jakub at gcc dot gnu.org
  2021-07-27 14:14 ` moritz.baumann at sap dot com
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-07-10 17:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Wed Jul 10 16:52:19 2013
New Revision: 200879

URL: http://gcc.gnu.org/viewcvs?rev=200879&root=gcc&view=rev
Log:
    PR preprocessor/57824
    * lex.c (lex_raw_string): Allow reading new-lines if
    in_deferred_pragma or if parsing_args and there is still
    data in the current buffer.

    * c-c++-common/raw-string-17.c: New test.
    * c-c++-common/gomp/pr57824.c: New test.

Added:
    trunk/gcc/testsuite/c-c++-common/gomp/pr57824.c
    trunk/gcc/testsuite/c-c++-common/raw-string-17.c
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libcpp/ChangeLog
    trunk/libcpp/lex.c

Fixed for 4.9+.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/57824] Raw string literals not handled correctly in macro arguments or deferred pragmas
  2013-07-04 17:21 [Bug preprocessor/57824] New: Raw string literals not handled correctly in macro arguments or deferred pragmas jakub at gcc dot gnu.org
  2013-07-10 17:43 ` [Bug preprocessor/57824] " jakub at gcc dot gnu.org
@ 2013-08-13 17:03 ` jakub at gcc dot gnu.org
  2021-07-27 14:14 ` moritz.baumann at sap dot com
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-08-13 17:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bcmpinc at hotmail dot com

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
*** Bug 52852 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/57824] Raw string literals not handled correctly in macro arguments or deferred pragmas
  2013-07-04 17:21 [Bug preprocessor/57824] New: Raw string literals not handled correctly in macro arguments or deferred pragmas jakub at gcc dot gnu.org
  2013-07-10 17:43 ` [Bug preprocessor/57824] " jakub at gcc dot gnu.org
  2013-08-13 17:03 ` jakub at gcc dot gnu.org
@ 2021-07-27 14:14 ` moritz.baumann at sap dot com
  2 siblings, 0 replies; 4+ messages in thread
From: moritz.baumann at sap dot com @ 2021-07-27 14:14 UTC (permalink / raw)
  To: gcc-bugs

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

Moritz Baumann <moritz.baumann at sap dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |moritz.baumann at sap dot com

--- Comment #4 from Moritz Baumann <moritz.baumann at sap dot com> ---
Raw string literals are still not handled correctly in macros in some cases:

#define myMacro(string) u##string

int square(int num) {
    auto string = myMacro(R"EOF(



    )EOF");
    // intentional syntax error
    return num * num
}

(https://godbolt.org/z/qYfax5E8x)

The line number in the compiler error message refers to a line that doesn't
even exist. It seems like line breaks in the raw string literal are counted
twice.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-27 14:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-04 17:21 [Bug preprocessor/57824] New: Raw string literals not handled correctly in macro arguments or deferred pragmas jakub at gcc dot gnu.org
2013-07-10 17:43 ` [Bug preprocessor/57824] " jakub at gcc dot gnu.org
2013-08-13 17:03 ` jakub at gcc dot gnu.org
2021-07-27 14:14 ` moritz.baumann at sap dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).