Bad comment line in v8-internal.h can break clients

9 views
Skip to first unread message

Jeroen Ooms

unread,
Sep 1, 2025, 7:19:16 AM (6 days ago) Sep 1
to v8-dev
Client applications building against v8 see a warning:

../include/v8-internal.h:436:1: warning: multi-line comment [-Wcomment]

The bug is that this file contains an (otherwise beautiful!) ascii diagram in it's comments, however two lines of this drawing end with a backslash, which get interpreted as an escape.

Because this is a header file that gets included by client applications, it may actually break applications that build with -Werror.

 



Matthias Liedtke

unread,
Sep 1, 2025, 8:14:27 AM (6 days ago) Sep 1
to v8-...@googlegroups.com
Configuring warnings as errors will always lead to "breaking changes" if the set of warnings between the library (v8) and the client mismatches.
It seems that
// first line \
// second line
produces a warning with -Wcomment.
This warning is not included in either -Wextra nor -Wpedantic, so I'm not sure how V8 could make sure that no client breaks if they enable additional warnings while also running with warnings as errors.
Furthermore, this does not produce a warning in clang only in gcc (https://godbolt.org/z/9b71ab57f) which is not officially supported.

So from a V8 perspective this header file is perfectly fine and I'd argue the issue is in the build configuration of the project including V8.
(We could "fix" this as a one-off but that doesn't mean that this won't reappear or that other additional warnings couldn't lead to any other such issues.)

--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/v8-dev/0d3f6ed1-6ef2-45e5-ab05-aa77c0fbed67n%40googlegroups.com.


--

Matthias Liedtke

Software Engineer

mlie...@google.com


Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Liana Sebastian

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls Sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. 

     

This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.


Jeroen Ooms

unread,
Sep 1, 2025, 8:51:13 AM (6 days ago) Sep 1
to v8-...@googlegroups.com
On Mon, Sep 1, 2025 at 2:14 PM 'Matthias Liedtke' via v8-dev
<v8-...@googlegroups.com> wrote:
>
> Configuring warnings as errors will always lead to "breaking changes" if the set of warnings between the library (v8) and the client mismatches.
> It seems that
>
> // first line \
> // second line
>
> produces a warning with -Wcomment.
> This warning is not included in either -Wextra nor -Wpedantic, so I'm not sure how V8 could make sure that no client breaks if they enable additional warnings while also running with warnings as errors.

OK. FWIW I'm seeing this on gcc 14 with -O2 -Wall . But I can patch it
on my end if this is not a supported toolchain.

Matthias Liedtke

unread,
Sep 1, 2025, 9:06:11 AM (6 days ago) Sep 1
to v8-...@googlegroups.com
Ah, I forgot -Wall in my example, yeah, seems like GCC considers this warning to be useful.
You could add -Wno-comment if you don't care about this particular warning.
AFAIK we still accept patches to fix GCC-only issues but GCC isn't supported any more, see: https://groups.google.com/g/v8-users/c/-vbS2agi1Kw
So if you'd like to fix it upstream, please feel free to upload a patch. (Maybe using a block comment /* */ instead as that doesn't seem to trigger the warning? Other options would probably look somewhat ugly.)

--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.

Jakob Kummerow

unread,
Sep 1, 2025, 2:19:54 PM (6 days ago) Sep 1
to v8-...@googlegroups.com
I would expect that we have many more ASCII art comments where lines happen to end with backslashes, so I would recommend against trying to fix this as a one-off. -Wno-comment seems like a more sustainable solution.

Reply all
Reply to author
Forward
0 new messages