Skip to content

Conversation

@mixern6
Copy link

@mixern6 mixern6 commented Oct 1, 2023

The PR fixes these compilation errors:

  • error: increment of object of volatile-qualified type 'volatile int' is deprecated
  • error: ISO C++17 does not allow 'register' storage class specifier
  • error: too many arguments provided to function-like macro invocation clamp

Explanation:

@GAMMACASE
Copy link
Member

You probably wanted to target cs2 branch instead of csgo?

@mixern6
Copy link
Author

mixern6 commented Oct 2, 2023

It is relevant for CS2 too, but I'd like to sort out these problems for CS:GO before moving on to CS2

@GAMMACASE
Copy link
Member

The ifdef around the clamp wouldn't cover all the cases, as earlier cpp versions also could trigger. The macro would later conflict with libraries like algorithm, you can btw remove it completely as I see there's a clamp function defined in basetypes.h in hl2sdk codebase so it gets picked up.

@mixern6
Copy link
Author

mixern6 commented Oct 2, 2023

The ifdef around the clamp wouldn't cover all the cases, as earlier cpp versions also could trigger. The macro would later conflict with libraries like algorithm, you can btw remove it completely as I see there's a clamp function defined in basetypes.h in hl2sdk codebase so it gets picked up.

Removed the clamp definition. SourceMod building finishes without errors.

@GAMMACASE
Copy link
Member

GAMMACASE commented Oct 2, 2023

I can't merge the csgo pr's, but by any chance if you are able to duplicate it also to the cs2 branch I'll merge that in as cs2 is the same in this regard. Otherwise looks good to me.

@GAMMACASE GAMMACASE requested a review from psychonic October 2, 2023 11:56
@mixern6 mixern6 changed the title Fix compilation errors for std=c++2a [CS:GO] Fix compilation errors for std=c++2a Oct 2, 2023
@mixern6
Copy link
Author

mixern6 commented Oct 2, 2023

I can't merge the csgo pr's, but by any chance if you are able to duplicate it also to the cs2 branch I'll merge that in as cs2 is the same in this regard. Otherwise looks good to me.

What will happen to this PR? I see the problem is relevant for all the other SDK's. Can the fix be merged to all of them? Shall I create a separate PR for each SDK?

@GAMMACASE Could you please cherry-pick this change to all the branches?

@Kenzzer
Copy link
Member

Kenzzer commented Sep 24, 2025

I'm a bit confused by this PR's title, specifically the std=c++2a which is documented as enabling C++20 on GCC 9 and earlier.
The small issue is, we don't support C++20 and neither does Valve still preferring C++11. Ideally one shouldn't have to deviate from the C++ version we're using. For instance we decided to downgrade safetyhook from C++23 to C++17/11 for our needs rather than bumping C++.

If the intent is making the SDKs compatible with C++20 that's fine, but we can't cherry pick this for every branch, each should be addressed individually because there's definitively going to be conflicts in cherry-picking and we're also probably missing other cpp files with C++20 related issues.

Wording this differently, let's not expand the scope of this PR otherwise it's never going to get merged. Let's restrain ourselves to just updating csgo & cs2 branch with those changes and if C++20 compatibility is desired for other branches we can get to it then.

@Kenzzer Kenzzer closed this Sep 26, 2025
@Headline
Copy link
Member

we'll definitely take whatever compat args are necessary to build SM on newer compilers if we're forced to

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.

5 participants