https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245006

            Bug ID: 245006
           Summary: toolchain: clang issues bogus "warning: multi-line //
                    comment [-Wcomment]"
           Product: Base System
           Version: 12.1-RELEASE
          Hardware: Any
               URL: https://github.com/Genivia/RE-flex/issues/68
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: standards
          Assignee: standa...@freebsd.org
          Reporter: mand...@freebsd.org
                CC: toolch...@freebsd.org

Greetings,

debugging a ports/textproc/re-flex 1.6.4 issue, I came across a standards
violation in clang, observed in base clang 8.0.1 (FreeBSD 12.1 amd64), ports
clang 9 and clang-devel as of today (llvm90-9.0.1 llvm-devel-11.0.d20200117),
but not gcc-9.2.0 from ports.

Save these two lines as try.c:

// \
x
void f(void) {}

Then observe:
$ gcc -pedantic-errors -std=c11 -c /tmp/try.c 
(no output)

$ /usr/bin/clang -pedantic-errors -std=c11 -c /tmp/try.c 
/tmp/try.c:1:4: error: multi-line // comment [-Werror,-Wcomment]
// \
   ^
1 error generated.

Reading up in C99, C11, C++11, it is clear that line merging happens in
compilation phase 2, before phase 3 elides comments and replaces them by one
space.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"

Reply via email to