Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Mar 2020 13:29:29 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 245006] toolchain: clang issues bogus "warning: multi-line // comment [-Wcomment]"
Message-ID:  <bug-245006-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D245006

            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@FreeBSD.org
          Reporter: mandree@FreeBSD.org
                CC: toolchain@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=3Dc11 -c /tmp/try.c=20
(no output)

$ /usr/bin/clang -pedantic-errors -std=3Dc11 -c /tmp/try.c=20
/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.

--=20
You are receiving this mail because:
You are on the CC list for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-245006-29464>