Skip to content

Remove pinning c++ version from get_stdopt #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

anutosh491
Copy link
Collaborator

Description

Please include a summary of changes, motivation and context for this PR.

Fixes #202

Type of change

Please tick all options which are relevant.

  • Bug fix
  • New feature
  • Added/removed dependencies
  • Required documentation updates

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.72%. Comparing base (dc14222) to head (2cfa270).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #203   +/-   ##
=======================================
  Coverage   80.72%   80.72%           
=======================================
  Files          19       19           
  Lines         970      970           
  Branches       93       93           
=======================================
  Hits          783      783           
  Misses        187      187           
Files with missing lines Coverage Δ
src/xinterpreter.cpp 91.20% <ø> (ø)
Files with missing lines Coverage Δ
src/xinterpreter.cpp 91.20% <ø> (ø)

@anutosh491
Copy link
Collaborator Author

anutosh491 commented Jan 9, 2025

After I updated cppinterop's recipe on emscripten-forge (emscripten-forge/recipes#1515)
we can let Cpp::Evaluate capture the LastValue.

So we don't need to hardcode the version rather, we can run

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 ()

In the browser itself and fetch 20. (can be seen if add a simple cout statement in get_stdopt after fetching the version)

auto cxx_version = Cpp::Evaluate(code);
std::cout << std::to_string(cxx_version) << std::endl;
return std::to_string(cxx_version); 

would give the following
image

Copy link
Contributor

github-actions bot commented Jan 9, 2025

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@anutosh491
Copy link
Collaborator Author

Thank you, merging !

@anutosh491 anutosh491 merged commit 15297a3 into compiler-research:main Jan 9, 2025
14 checks passed
@anutosh491 anutosh491 deleted the fix_get_stdopt branch January 9, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove pinning cxx_version in get_stdopt for xeus-cpp-lite
3 participants