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

release/18.x: [Headers] Don't declare unreachable() from stddef.h in C++ (#86748) #87696

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

llvmbot
Copy link
Collaborator

@llvmbot llvmbot commented Apr 4, 2024

Backport df69a30

Requested by: @ian-twilightcoder

@llvmbot llvmbot added this to the LLVM 18.X Release milestone Apr 4, 2024
@llvmbot
Copy link
Collaborator Author

llvmbot commented Apr 4, 2024

@AaronBallman What do you think about merging this PR to the release branch?

@llvmbot llvmbot added clang Clang issues not falling into any other category backend:X86 clang:headers Headers provided by Clang, e.g. for intrinsics labels Apr 4, 2024
@llvmbot
Copy link
Collaborator Author

llvmbot commented Apr 4, 2024

@llvm/pr-subscribers-backend-x86

@llvm/pr-subscribers-clang

Author: None (llvmbot)

Changes

Backport df69a30

Requested by: @ian-twilightcoder


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

1 Files Affected:

  • (modified) clang/lib/Headers/__stddef_unreachable.h (+4)
diff --git a/clang/lib/Headers/__stddef_unreachable.h b/clang/lib/Headers/__stddef_unreachable.h
index 518580c92d3f5d..61df43e9732f8a 100644
--- a/clang/lib/Headers/__stddef_unreachable.h
+++ b/clang/lib/Headers/__stddef_unreachable.h
@@ -7,6 +7,8 @@
  *===-----------------------------------------------------------------------===
  */
 
+#ifndef __cplusplus
+
 /*
  * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
  * and needs to behave as if it was textual.
@@ -15,3 +17,5 @@
     (__has_feature(modules) && !__building_module(_Builtin_stddef))
 #define unreachable() __builtin_unreachable()
 #endif
+
+#endif

@ian-twilightcoder
Copy link
Contributor

Nominating for backport because this is a C++ regression that was caused by https://reviews.llvm.org/D157757

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

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

LGTM for backporting

@ian-twilightcoder
Copy link
Contributor

@tstellar is there anything else I need to do for this one?

Even if __need_unreachable is set, stddef.h should not declare
unreachable() in C++ because it conflicts with the declaration in
\<utility>.

(cherry picked from commit df69a30)
@tstellar tstellar merged commit 429d628 into llvm:release/18.x Apr 10, 2024
7 of 8 checks passed
@tstellar
Copy link
Collaborator

Hi @ian-twilightcoder (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix.

@ian-twilightcoder
Copy link
Contributor

I don't think we need to release note this one, it's just restoring LLVM 17 behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 clang:headers Headers provided by Clang, e.g. for intrinsics clang Clang issues not falling into any other category
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants