[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-23 Thread Jamie Schmeiser via cfe-commits
jamieschmeiser wrote: > I think it makes sense for Clang to handle the C Standard Library headers > which can introduce `NULL`, but I'm surprised to see us adding new headers > like `dbm.h`, the `sys` directory, and `unistd,h`. These other headers define NULL to 0 on AIX and are included throu

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-21 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,24 @@ +/*=== dbm.h - BSD header for database management --===*\ + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apa

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-21 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > In other words, part of the motivation of this PR is to address a general > issue where Clang fails to cover the set of headers that it ought to. I think it makes sense for Clang to handle the C Standard Library headers which can introduce `NULL`, but I'm surprised to see

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Jamie Schmeiser via cfe-commits
jamieschmeiser wrote: > > are you saying that you have a strong preference to not handle locale.h > > (for example) for non-AIX environments? > > Yes. > > You know exactly which AIX headers define NULL, and because IBM also ships > the AIX headers, you can ensure no future version of the head

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > are you saying that you have a strong preference to not handle locale.h (for > example) for non-AIX environments? Yes. You know exactly which AIX headers define NULL, and because IBM also ships the AIX headers, you can ensure no future version of the headers changes th

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,15 @@ +// There are at least 2 valid C null-pointer constants as defined +// by the C language standard. +// Test that the macro NULL is defined consistently for all platforms by +// those headers that the C standard mandates a macro definition for NULL. + +// RUN: %cla

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Jamie Schmeiser via cfe-commits
jamieschmeiser wrote: > What logic did you use to decide which headers should use `#idfdef _AIX`? The headers that exist on AIX that define NULL but are not mandated by the C standard to define NULL are guarded with `#ifdef _AIX`. See previous comment: > For those non-mandated system headers

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Hubert Tong via cfe-commits
hubert-reinterpretcast wrote: > I'm not going to argue very hard about it, but I don't really want to > entangle every other operating system in this. The current situation is > mostly stable. @efriedma-quic, are you saying that you have a strong preference to not handle `locale.h` (for examp

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Hubert Tong via cfe-commits
@@ -0,0 +1,15 @@ +// There are at least 2 valid C null-pointer constants as defined +// by the C language standard. +// Test that the macro NULL is defined consistently for all platforms by +// those headers that the C standard mandates a macro definition for NULL. + +// RUN: %cla

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Jamie Schmeiser via cfe-commits
@@ -0,0 +1,15 @@ +// There are at least 2 valid C null-pointer constants as defined +// by the C language standard. +// Test that the macro NULL is defined consistently for all platforms by +// those headers that the C standard mandates a macro definition for NULL. + +// RUN: %cla

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: I guess... if you think this is what's best for AIX, I'm not going to argue very hard about it, but I don't really want to entangle every other operating system in this. The current situation is mostly stable. What logic did you use to decide which

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,15 @@ +// There are at least 2 valid C null-pointer constants as defined +// by the C language standard. +// Test that the macro NULL is defined consistently for all platforms by +// those headers that the C standard mandates a macro definition for NULL. + +// RUN: %cla

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/149176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Jamie Schmeiser via cfe-commits
jamieschmeiser wrote: > This seems like a very complicated solution. > > If the AIX system headers want to define NULL, should we just let them? Just > `#include_next ` to ensure clang's stddef.h doesn't define NULL in > an inconsistent way. Just doing an `#include_next ` is a dangerous solut

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Jamie Schmeiser via cfe-commits
@@ -39,6 +39,25 @@ set(core_files varargs.h ) +set(aix_wrapper_files + dbm.h + stdio.h + stdlib.h + string.h + time.h + unistd.h + wchar.h + ) jamieschmeiser wrote: Thanks @hubert-reinterpretcast, good catch. I will add it in. https://github.com

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-17 Thread Jamie Schmeiser via cfe-commits
https://github.com/jamieschmeiser updated https://github.com/llvm/llvm-project/pull/149176 >From e50062b48a09bd6e077b86bdeed65c7c1abb2ebe Mon Sep 17 00:00:00 2001 From: Jamie Schmeiser Date: Wed, 16 Jul 2025 15:40:09 -0400 Subject: [PATCH] Ensure proper NULL macro definition for system include

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-16 Thread Hubert Tong via cfe-commits
@@ -39,6 +39,25 @@ set(core_files varargs.h ) +set(aix_wrapper_files + dbm.h + stdio.h + stdlib.h + string.h + time.h + unistd.h + wchar.h + ) hubert-reinterpretcast wrote: At least `locale.h` was also affected. https://github.com/llvm/llvm-proje

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-16 Thread via cfe-commits
github-actions[bot] wrote: ⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo. Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account. See [LLVM Developer Policy](https://llvm.org/docs/DeveloperPol

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-16 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-backend-x86 Author: Jamie Schmeiser (jamieschmeiser) Changes The C standard allows for at least 2 valid definitions of a null pointer constant and mandates that several standard headers files define the macro NULL to be a null pointer constant. Ensure

[clang] Ensure proper NULL macro definition for system include files. (PR #149176)

2025-07-16 Thread Jamie Schmeiser via cfe-commits
https://github.com/jamieschmeiser created https://github.com/llvm/llvm-project/pull/149176 The C standard allows for at least 2 valid definitions of a null pointer constant and mandates that several standard headers files define the macro NULL to be a null pointer constant. Ensure that defini