Skip to content

get_stdopt caters only to the c++ kernel #397

@anutosh491

Description

@anutosh491

static std::string get_stdopt()
{
// We need to find what's the C++ version the interpreter runs with.
const char* code = R"(
int __get_cxx_version () {
#if __cplusplus > 202302L
return 26;
#elif __cplusplus > 202002L
return 23;
#elif __cplusplus > 201703L
return 20;
#elif __cplusplus > 201402L
return 17;
#elif __cplusplus > 201103L || (defined(_WIN32) && _MSC_VER >= 1900)
return 14;
#elif __cplusplus >= 201103L
return 11;
#else
return 0;
#endif
}
__get_cxx_version ()
)";
auto cxx_version = Cpp::Evaluate(code);
return std::to_string(cxx_version);
}

Defines version for the kernel based on __get_cxx_version and this variable ends up taking 0 for the kernel version (for any C kernel). For example from the wasm kernel (pasting the wasm content)

  (func $__get_cxx_version (;2;) (export "__get_cxx_version") (result i32)
    i32.const 0
  )

So a kernel info request would show the version to be 0 instead of C23.

We should probably fetch information from the Kernel spec whether a C or C++ kernel is defined and use get_stdopt accordingly !

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions