Skip to content
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

Update __func__ and __PRETTY_FUNCTION__ defines for MSVC #6222

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

watk
Copy link
Contributor

@watk watk commented Jan 20, 2025

This change updates the function name preprocessor defines for modern MSVC. Specifically:

  • remove #define __func__ because MSVC has supported this standard define since Visual Studio 2015, and pcl only supports Visual Studio 2017 and newer.
  • alias __PRETTY_FUNCTION__ to MSVC's __FUNCSIG__ instead of the previous alias to __FUNCTION__, because the former is a better match.

Note: I haven't tested this change.

Fixes #6220

@@ -217,7 +217,6 @@
#endif

#define __PRETTY_FUNCTION__ __FUNCTION__
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#define __PRETTY_FUNCTION__ __FUNCTION__
#define __PRETTY_FUNCTION__ __FUNCSIG__

See: https://godbolt.org/z/T3P4PWfoj and https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-140

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, thanks

@watk watk changed the title Delete unneeded #define __func__ from pcl_macros.h Update __func__ and __PRETTY_FUNCTION__ defines in pcl_macros.h Jan 22, 2025
@watk watk changed the title Update __func__ and __PRETTY_FUNCTION__ defines in pcl_macros.h Update __func__ and __PRETTY_FUNCTION__ defines in for MSVC Jan 22, 2025
@watk watk requested a review from larshg January 22, 2025 03:54
@watk watk changed the title Update __func__ and __PRETTY_FUNCTION__ defines in for MSVC Update __func__ and __PRETTY_FUNCTION__ defines for MSVC Jan 22, 2025
Copy link
Member

@mvieth mvieth left a comment

Choose a reason for hiding this comment

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

Thank you!

@mvieth mvieth added module: common changelog: fix Meta-information for changelog generation labels Jan 22, 2025
@mvieth mvieth merged commit 6b93e78 into PointCloudLibrary:master Jan 22, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Meta-information for changelog generation module: common
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pcl_macros.h] PCL redefines __func__ needlessly to a different value for MSVC
3 participants