Skip to content

[libunwind] Make sure __STDC_FORMAT_MACROS is defined to ensure PRId64 is available #117491

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

Closed
wants to merge 1 commit into from

Conversation

Zentrik
Copy link
Contributor

@Zentrik Zentrik commented Nov 24, 2024

See #102980 for further details.

@Zentrik Zentrik requested a review from a team as a code owner November 24, 2024 14:44
@Zentrik Zentrik changed the title [unwind] Make sure __STDC_FORMAT_MACROS is defined to ensure `PRId6… [unwind] Make sure __STDC_FORMAT_MACROS is defined to ensure PRId64 is available Nov 24, 2024
@Zentrik Zentrik changed the title [unwind] Make sure __STDC_FORMAT_MACROS is defined to ensure PRId64 is available [libunwind] Make sure __STDC_FORMAT_MACROS is defined to ensure PRId64 is available Nov 24, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 24, 2024

@llvm/pr-subscribers-libunwind

Author: None (Zentrik)

Changes

See #102980 for further details.


Full diff: https://github.com/llvm/llvm-project/pull/117491.diff

1 Files Affected:

  • (modified) libunwind/src/DwarfParser.hpp (+4)
diff --git a/libunwind/src/DwarfParser.hpp b/libunwind/src/DwarfParser.hpp
index 7e85025dd054d5..54357f56494330 100644
--- a/libunwind/src/DwarfParser.hpp
+++ b/libunwind/src/DwarfParser.hpp
@@ -12,6 +12,10 @@
 #ifndef __DWARF_PARSER_HPP__
 #define __DWARF_PARSER_HPP__
 
+#ifndef __STDC_FORMAT_MACROS
+// Ensure PRId64 macro is available
+#define __STDC_FORMAT_MACROS 1
+#endif
 #include <inttypes.h>
 #include <stdint.h>
 #include <stdio.h>

@Zentrik
Copy link
Contributor Author

Zentrik commented Nov 29, 2024

@ldionne Do you mind merging this as I don't have commit rights. Thank you

@MaskRay
Copy link
Member

MaskRay commented Nov 29, 2024

What old GCC versions need this? If it's just GCC 8, it's possible that we will drop GCC buildability soon. I think for runtime libraries we could pose a stricter requirement.

@ldionne
Copy link
Member

ldionne commented Nov 29, 2024

Ah, I didn't realize this was only required for much older compilers. In that case, indeed we don't support GCC 8 so we probably don't want to merge this.

@giordano
Copy link
Contributor

@Zentrik
Copy link
Contributor Author

Zentrik commented Nov 29, 2024

Based on WAVM/WAVM#266 (comment) and https://en.cppreference.com/w/cpp/types/integer#Notes this might have been fixed in glibc 2.18.

@ldionne
Copy link
Member

ldionne commented Dec 5, 2024

Since we support only the latest released GCC in the runtimes, so I don't think it makes sense to merge this. Newer GCCs don't seem to have this issue.

Closing, please reopen if you'd like to pursue this despite the above information and we can chat.

@ldionne ldionne closed this Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants