[Bug 245006] toolchain: clang issues bogus "warning: multi-line // comment [-Wcomment]"

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Mar 23 13:29:30 UTC 2020


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: standards at FreeBSD.org
          Reporter: mandree at FreeBSD.org
                CC: toolchain at 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.


More information about the freebsd-toolchain mailing list