[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-07-08 Thread via cfe-commits
bgra8 wrote: > > > @AaronBallman > > > [N2848](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2848.pdf) > > > explicitly mentions that `NAN` and `INFINITY` macros should expand to a > > > constant expression of type `float` not `double` like was implemented in > > > this patch. > > > `__bu

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-07-08 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > @AaronBallman > > [N2848](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2848.pdf) > > explicitly mentions that `NAN` and `INFINITY` macros should expand to a > > constant expression of type `float` not `double` like was implemented in > > this patch. > > `__builtin

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-07-08 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @AaronBallman > [N2848](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2848.pdf) > explicitly mentions that `NAN` and `INFINITY` macros should expand to a > constant expression of type `float` not `double` like was implemented in this > patch. > > `__builtin_nanf` an

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-07-08 Thread via cfe-commits
bgra8 wrote: @AaronBallman [N2848](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2848.pdf) explicitly mentions that `NAN` and `INFINITY` macros should expand to a constant expression of type `float` not `double` like was implemented in this patch. `__builtin_nanf` and `__builtin_inff` sh

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-07-03 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/96659 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-07-02 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/96659 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-07-01 Thread Aaron Ballman via cfe-commits
@@ -47,6 +47,8 @@ (defined(__cplusplus) && __cplusplus >= 201103L) || \ (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE)) #undef DECIMAL_DIG +#undef INFINITY AaronBallman wrote: Good catch, I've corrected this.

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-07-01 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff de68294b4dd31370773cb7a976b2d59e0e8b9bcc 1ba1735702376bfb46b96d819ab141f1c841263a --

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-07-01 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > We already have `-Wnan-infinity-disabled`, which I think is sufficient on the > warning side? Haven't checked carefully to see what cases it covers. Not this one. :-D https://godbolt.org/z/hq8jvse9o But yeah, that may be a good diagnostic to consider putting this under, b

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-28 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: We already have `-Wnan-infinity-disabled`, which I think is sufficient on the warning side? Haven't checked carefully to see what cases it covers. https://github.com/llvm/llvm-project/pull/96659 ___ cfe-com

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-28 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/96659 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-28 Thread Eli Friedman via cfe-commits
@@ -47,6 +47,8 @@ (defined(__cplusplus) && __cplusplus >= 201103L) || \ (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE)) #undef DECIMAL_DIG +#undef INFINITY efriedma-quic wrote: The define guarding the undefs n

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-28 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/96659 >From b59c7f8c91d7c128975554d90bef3657ce3b2728 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 25 Jun 2024 10:52:56 -0400 Subject: [PATCH 1/3] [C23] Add INFINITY and NAN macros to This is in suppor

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-28 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/96659 >From b59c7f8c91d7c128975554d90bef3657ce3b2728 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 25 Jun 2024 10:52:56 -0400 Subject: [PATCH 1/3] [C23] Add INFINITY and NAN macros to This is in suppor

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-27 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > In short: IMHO, `INFINITY` should expand to something that bops the user > (i.e., warn/error by default) and says "you're doing something wrong" in > finite-math-only mode. @jcranmer-intel and I had a really nice offline discussion on this topic and I've come around to h

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-27 Thread Joshua Cranmer via cfe-commits
jcranmer-intel wrote: Some thoughts of my own: The decision being discussed here has two main repercussions: * An attempt to use `INFINITY` gets a symbol-not-found error message, or it gets whatever warning/error message we attach to `__builtin_inf()` in `-ffinite-math-only` mode. * Code that

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-27 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: I was thinking about this more last night. The standard says: > The macro >`INFINITY` > is defined if and only if the implementation supports an infinity for the > type float. It expands to a > constant expression of type float representing positive or unsigned infinity.

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-26 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > I looked at my meeting notes for discussion of this paper and I think we do > > need to worry about what the C standard says. From my notes: `The big > > intent from this change seems to be about making INFINITY to be a feature > > test macro.`, so if users are going to

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-25 Thread Joshua Cranmer via cfe-commits
jcranmer-intel wrote: > I looked at my meeting notes for discussion of this paper and I think we do > need to worry about what the C standard says. From my notes: `The big intent > from this change seems to be about making INFINITY to be a feature test > macro.`, so if users are going to porta

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-25 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > and that implies (at least to me) that an expression cannot form an > > infinity to begin with, so the act of trying to expand INFINITY is > > nonsensical in that case, right? > > It's undefined behavior at runtime. > > I don't think we need to worry too much about wha

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-25 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > and that implies (at least to me) that an expression cannot form an infinity > to begin with, so the act of trying to expand INFINITY is nonsensical in that > case, right? It's undefined behavior at runtime. I don't think we need to worry too much about what the C stand

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-25 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I'm not sure about tying this to `__FINITE_MATH_ONLY__`; -ffinite-math-only > doesn't mean infinity doesn't exist, it just means you're promising that you > won't use floating-point arithmetic/comparison ops on infinity. Which is > weird, but that's fast-math. Also, other

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-25 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/96659 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-25 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: I'm not sure about tying this to __FINITE_MATH_ONLY__; -ffinite-math-only doesn't mean infinity doesn't exist, it just means you're promising that you won't use floating-point arithmetic/comparison ops on infinity. Which is weird, but that's fast-ma

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-25 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Link to WG14 N2848: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2848.pdf https://github.com/llvm/llvm-project/pull/96659 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-25 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Aaron Ballman (AaronBallman) Changes This is in support of WG14 N2848 which only define the macros if infinity and nan are supported, so use of -ffinite-math will cause the macros to not be defined. --- Full diff: https://github.com/llvm/l

[clang] [C23] Add INFINITY and NAN macros to (PR #96659)

2024-06-25 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/96659 This is in support of WG14 N2848 which only define the macros if infinity and nan are supported, so use of -ffinite-math will cause the macros to not be defined. >From b59c7f8c91d7c128975554d90bef3657ce3b272