-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Ensure proper NULL macro definition for system include files. #149176
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: Apache-2.0 WITH LLVM-exception | ||
| * | ||
| \*===----------------------------------------------------------------------===*/ | ||
|
|
||
| #if !defined(_AIX) | ||
|
|
||
| #include_next <dbm.h> | ||
|
|
||
| #else | ||
|
|
||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #include_next <dbm.h> | ||
|
|
||
| /* Ensure that the definition of NULL is as expected. */ | ||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
Comment on lines
+15
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the pattern to define |
||
|
|
||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /*===---- locale.h - Standard header for localization ---------------------===*\ | ||
| * | ||
| * 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: Apache-2.0 WITH LLVM-exception | ||
| * | ||
| \*===----------------------------------------------------------------------===*/ | ||
|
|
||
| #if !defined(_AIX) | ||
|
|
||
| #include_next <locale.h> | ||
|
|
||
| #else | ||
|
|
||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #include_next <locale.h> | ||
|
|
||
| /* Ensure that the definition of NULL is as expected. */ | ||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /*===---- stdio.h - Standard header for input and output-------------------===*\ | ||
| * | ||
| * 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: Apache-2.0 WITH LLVM-exception | ||
| * | ||
| \*===----------------------------------------------------------------------===*/ | ||
|
|
||
| #if !defined(_AIX) | ||
|
|
||
| #include_next <stdio.h> | ||
|
|
||
| #else | ||
|
|
||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #include_next <stdio.h> | ||
|
|
||
| /* Ensure that the definition of NULL is as expected. */ | ||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /*===---- stdlib.h - Standard header for general utilities ----------------===*\ | ||
| * | ||
| * 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: Apache-2.0 WITH LLVM-exception | ||
| * | ||
| \*===----------------------------------------------------------------------===*/ | ||
|
|
||
| #if !defined(_AIX) | ||
|
|
||
| #include_next <stdlib.h> | ||
|
|
||
| #else | ||
|
|
||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #include_next <stdlib.h> | ||
|
|
||
| /* Ensure that the definition of NULL is as expected. */ | ||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /*===---- string.h - Standard header for string handling ------------------===*\ | ||
| * | ||
| * 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: Apache-2.0 WITH LLVM-exception | ||
| * | ||
| \*===----------------------------------------------------------------------===*/ | ||
|
|
||
| #if !defined(_AIX) | ||
|
|
||
| #include_next <string.h> | ||
|
|
||
| #else | ||
|
|
||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #include_next <string.h> | ||
|
|
||
| /* Ensure that the definition of NULL is as expected. */ | ||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /*===---- sys/dir.h - BSD header for directory handling -------------------===*\ | ||
| * | ||
| * 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: Apache-2.0 WITH LLVM-exception | ||
| * | ||
| \*===----------------------------------------------------------------------===*/ | ||
|
|
||
| #if !defined(_AIX) | ||
|
|
||
| #include_next <sys/dir.h> | ||
|
|
||
| #else | ||
|
|
||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #include_next <sys/dir.h> | ||
|
|
||
| /* Ensure that the definition of NULL is as expected. */ | ||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /*===---- sys/param.h - BSD header ----------------------------------------===*\ | ||
| * | ||
| * 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: Apache-2.0 WITH LLVM-exception | ||
| * | ||
| \*===----------------------------------------------------------------------===*/ | ||
|
|
||
| #if !defined(_AIX) | ||
|
|
||
| #include_next <sys/param.h> | ||
|
|
||
| #else | ||
|
|
||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #include_next <sys/param.h> | ||
|
|
||
| /* Ensure that the definition of NULL is as expected. */ | ||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /*===---- sys/types.h - BSD header for types ------------------------------===*\ | ||
| * | ||
| * 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: Apache-2.0 WITH LLVM-exception | ||
| * | ||
| \*===----------------------------------------------------------------------===*/ | ||
|
|
||
| #if !defined(_AIX) | ||
|
|
||
| #include_next <sys/types.h> | ||
|
|
||
| #else | ||
|
|
||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #include_next <sys/types.h> | ||
|
|
||
| /* Ensure that the definition of NULL is as expected. */ | ||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /*===---- time.h - Standard header for date and time handling -------------===*\ | ||
| * | ||
| * 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: Apache-2.0 WITH LLVM-exception | ||
| * | ||
| \*===----------------------------------------------------------------------===*/ | ||
|
|
||
| #if !defined(_AIX) | ||
|
|
||
| #include_next <time.h> | ||
|
|
||
| #else | ||
|
|
||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #include_next <time.h> | ||
|
|
||
| /* Ensure that the definition of NULL is as expected. */ | ||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /*===---- unistd.h - Posix Standard header --------------------------------===*\ | ||
| * | ||
| * 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: Apache-2.0 WITH LLVM-exception | ||
| * | ||
| \*===----------------------------------------------------------------------===*/ | ||
|
|
||
| #if !defined(_AIX) | ||
|
|
||
| #include_next <unistd.h> | ||
|
|
||
| #else | ||
|
|
||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #include_next <unistd.h> | ||
|
|
||
| /* Ensure that the definition of NULL is as expected. */ | ||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /*===---- wchar.h - Standard header for string handling ------------------===*\ | ||
| * | ||
| * 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: Apache-2.0 WITH LLVM-exception | ||
| * | ||
| \*===----------------------------------------------------------------------===*/ | ||
|
|
||
| #if !defined(_AIX) | ||
|
|
||
| #include_next <wchar.h> | ||
|
|
||
| #else | ||
|
|
||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #include_next <wchar.h> | ||
|
|
||
| /* Ensure that the definition of NULL is as expected. */ | ||
| #define __need_NULL | ||
| #include <stddef.h> | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // 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 by those system headers | ||
| // on AIX that have a macro definition for NULL. | ||
|
|
||
| // REQUIRES: system-aix | ||
|
|
||
| // RUN: %clang %s -Dheader="<dbm.h>" -E | tail -1 | FileCheck %s | ||
| // RUN: %clang %s -Dheader="<locale.h>" -E | tail -1 | FileCheck %s | ||
| // RUN: %clang %s -Dheader="<stdio.h>" -E | tail -1 | FileCheck %s | ||
| // RUN: %clang %s -Dheader="<stdlib.h>" -E | tail -1 | FileCheck %s | ||
| // RUN: %clang %s -Dheader="<string.h>" -E | tail -1 | FileCheck %s | ||
| // RUN: %clang %s -Dheader="<sys/dir.h>" -E | tail -1 | FileCheck %s | ||
| // RUN: %clang %s -Dheader="<sys/param.h>" -E | tail -1 | FileCheck %s | ||
| // RUN: %clang %s -Dheader="<sys/types.h>" -E | tail -1 | FileCheck %s | ||
| // RUN: %clang %s -Dheader="<time.h>" -E | tail -1 | FileCheck %s | ||
| // RUN: %clang %s -Dheader="<unistd.h>" -E | tail -1 | FileCheck %s | ||
| // RUN: %clang %s -Dheader="<wchar.h>" -E | tail -1 | FileCheck %s | ||
|
|
||
| #include header | ||
| void *p = NULL; | ||
| // CHECK: ({{ *}}({{ *}}void{{ *}}*{{ *}}){{ *}}0{{ *}}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.