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
@@ -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
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
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
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
@@ -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
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
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
@@ -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
@@ -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
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
@@ -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
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
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
@@ -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
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
@@ -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
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
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
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
20 matches
Mail list logo