Skip to content

test: fix warning for comment in embedtest

  • Build log(Ubuntu 20.04)
...
../test/embedding/embedtest.cc:67:3: warning: multi-line comment [-Wcomment]
   67 |   // embedtest js_code_to_eval arg1 arg2... \
      |   ^
../test/embedding/embedtest.cc:72:3: warning: multi-line comment [-Wcomment]
   72 |   // embedtest --embedder-snapshot-blob blob-path \
...

Warning messages are occurring due to a comments on the following line. https://github.com/nodejs/node/blob/3a6a80a4e1ad3fc3f1b181e1c94ecfd0b17e6dd1/test/embedding/embedtest.cc#L65-L76

A line of comment starting with // is supposed to end at the newline character. However, if a backslash(\) is placed at the end of the line, the comment is extended to the next line. This is because the backslash at the end of a line is a line-continuation character, which tells the compiler to treat the next line as a continuation of the current line. This can lead to unexpected behavior, hence the compiler warning.

There are several suggestions for solving this, but I suggest a simple way to remove the backslash(\).

Merge request reports

Loading