[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread YunQiang Su via cfe-commits
https://github.com/wzssyqa closed https://github.com/llvm/llvm-project/pull/123912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread YunQiang Su via cfe-commits
wzssyqa wrote: Thanks. So this patch is incorrect. Let's close it. https://github.com/llvm/llvm-project/pull/123912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I think it would be more useful in practice if the deprecation warnings > respected lazy evaluation, as the PR suggests, but it's worth noting that > this deviates from the C Standard, which specifies that macros are replaced > first, before short-circuit evaluation takes

[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread Fabian Ritter via cfe-commits
ritter-x2a wrote: I think it would be more useful in practice if the deprecation warnings respected lazy evaluation, as the PR suggests, but it's worth noting that this deviates from the C Standard, which specifies that macros are replaced first, before short-circuit evaluation takes place. h

[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread Fabian Ritter via cfe-commits
@@ -23,7 +23,7 @@ template __attribute__((host, device)) int templatify(int x) { __attribute__((device)) const int GlobalConst = __AMDGCN_WAVEFRONT_SIZE__; // expected-warning {{macro '__AMDGCN_WAVEFRONT_SIZE__' has been marked as deprecated}} constexpr int GlobalConstExpr =

[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,74 @@ +// RUN: %clang -E -MD -MF - %s | FileCheck -check-prefix ZERO_AND_HAS_INCLUDE %s +// +// ZERO_AND_HAS_INCLUDE-NOT: limits.h +// +#if 0 && __has_include() +#include +#endif + +#if 4==5 && __has_include() +#include +#endif + +#if defined(_THIS_IS_NOT_DEFINED) &&

[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread Aaron Ballman via cfe-commits
@@ -23,7 +23,7 @@ template __attribute__((host, device)) int templatify(int x) { __attribute__((device)) const int GlobalConst = __AMDGCN_WAVEFRONT_SIZE__; // expected-warning {{macro '__AMDGCN_WAVEFRONT_SIZE__' has been marked as deprecated}} constexpr int GlobalConstExpr =

[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread YunQiang Su via cfe-commits
https://github.com/wzssyqa updated https://github.com/llvm/llvm-project/pull/123912 >From f0010f932ae3c89651c631736a7aa495027e8fdc Mon Sep 17 00:00:00 2001 From: YunQiang Su Date: Wed, 22 Jan 2025 09:04:44 + Subject: [PATCH] Clang/Preprocessor: Support short circuit in directive Don't Eval

[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread via cfe-commits
cor3ntin wrote: Can you explain the motivation for this change? Thanks https://github.com/llvm/llvm-project/pull/123912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread Michael Spencer via cfe-commits
Bigcheese wrote: It's an alternative to https://github.com/llvm/llvm-project/pull/120673 This resolves my concerns with the original patch, and I'm pretty sure it doesn't cause any other issues, but I do plan to take a closer look in a bit. https://github.com/llvm/llvm-project/pull/123912

[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: YunQiang Su (wzssyqa) Changes Don't Evaluate RHS in if directive when short circuit. Examples include #if 0 && another_condition #if 1 || another_condition --- Full diff: https://github.com/llvm/llvm-project/pull/123912.diff 2 File

[clang] Clang/Preprocessor: Support short circuit in directive (PR #123912)

2025-01-22 Thread YunQiang Su via cfe-commits
https://github.com/wzssyqa created https://github.com/llvm/llvm-project/pull/123912 Don't Evaluate RHS in if directive when short circuit. Examples include #if 0 && another_condition #if 1 || another_condition >From 43ec3fe59bd5f1000e484fa98f323b1512a5e892 Mon Sep 17 00:00:00 2001 From: Y