question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]: Mysterious behavior with # in command line arguments

See original GitHub issue

Describe the bug

Consider the following code:

#warning "what?"
#pragma message("whattt??")

In Clang, you can silence the first diagnostic with -Wno-#warnings and the second with -Wno-#pragma-messages. Additionally, you can upgrade them into errors via -Werror=#warnings and -Werror=#pragma-messages.

However, in CE, you… can’t? Can? A bit of both? I honestly am not certain what’s going on.

Steps to reproduce

On the site, select Clang as the compiler, enter the code above.

  1. Add -Wno-#warnings -Wno-#pragma-messages as the command line arguments for the compiler. Notice that the diagnostics are not suppressed. Try it again on a native client and they will be.
  2. Delete the old command line arguments and add -Werror=#warnings -Werror=#pragma-messages instead. Notice that the #warning was upgraded into an error, but the #pragma message was not.
  3. Scratch your head and wonder how that happens. 😃

Expected behavior

For the first step, I’d expect both diagnostics to be suppressed same as on the command line. For the second step, I’d expect both diagnostics to be upgraded to an error. This is the behavior you get from the command line.

Reproduction link

https://godbolt.org/z/68Kej8Pf7

Screenshots

Not applicable

Operating System

No response

Browser version

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
partoufcommented, May 27, 2022

quoteParse is the culprit, it turns everything after # into an object https://www.npmjs.com/package/shell-quote

it sees it as a comment

0reactions
partoufcommented, May 27, 2022

confirmed with a unittest its indeed the splitArguments function

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strange behaviour of command line arguments in iOS ...
It checks the number of command line arguments. If it is larger than 3 prints a message to console and to a file....
Read more >
1724251 - Command line arguments handled in "command ...
We are using the same API in the "command-line-startup" observer as in "handle" so it seems strange that it doesn't have the same...
Read more >
[feature request] ln with command line arguments in reverse o
The issue simply is with the mental model made when approaching the "ln" command. In French, the usual way to say when creating...
Read more >
Strange behavior of argv when passing string containing "!!!!"
A problem only arises when I use more than one exclamation mark at the end of the string I want to pass as...
Read more >
bash function arguments strange behaviour
... process the function's command line in repeated invocations of it. ... When an option requires an argument, getopts places that argument ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found