Skip to content

-wpedantic reports erroneous warning for parameters in EM_ASM_ blocks #7113

Closed
@aaron-michaux

Description

@aaron-michaux

Compiling the following code should work without warning. Even in pedantic mode.

#include <emscripten.h>

int main(int, char * *)
{
    int x = EM_ASM_INT({
            console.log('I received: ' + $0);
            return $0 + 1;
        }, 100);
    printf("%d\n", x);
    return 0;
}

However, emcc reports the following warning:

~ > emcc --version
emcc (Emscripten gcc/clang-like replacement) 1.38.8 (commit 1c100d9f8ad4e073b33d64aed2fdf91cbc355cb3)

~ > emcc -x c++ -std=c++17 -stdlib=libc++ -DTARGET="ariel.html" -Wall -Wextra -Wpedantic test.cpp 
test.cpp:7:42: warning: '$' in identifier [-Wdollar-in-identifier-extension]
            console.log('I received: ' + $0);
                                         ^
test.cpp:8:20: warning: '$' in identifier [-Wdollar-in-identifier-extension]
            return $0 + 1;
                   ^
2 warnings generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions