Skip to content

Don't define posix macros that we don't support - #18337

Closed
sbc100 wants to merge 1 commit into
mainfrom
posix_macros
Closed

Don't define posix macros that we don't support#18337
sbc100 wants to merge 1 commit into
mainfrom
posix_macros

Conversation

@sbc100

@sbc100 sbc100 commented Dec 8, 2022

Copy link
Copy Markdown
Collaborator

While -1 is valid value for these, simply not defining them is perfectly acceptable and has the same meaning AFAICT. This makes the patch smaller, and also works for codebased that use #ifdef

This change was original made in #9452.

For some reason we were using -1, but AFAICT these macros are expected
to be undefined when not available.

This change was original made in #9452.
@sbc100

sbc100 commented Dec 8, 2022

Copy link
Copy Markdown
Collaborator Author

From https://pubs.opengroup.org/onlinepubs/000095399/ docs on unistd.h:

Constants for Options and Option Groups
The following symbolic constants, if defined in <unistd.h>, shall have a value of -1, 0, or greater, unless otherwise specified below. If these are undefined, the fpathconf(), pathconf(), or sysconf() functions can be used to determine whether the option is provided for a particular invocation of the application.

If a symbolic constant is defined with the value -1, the option is not supported. Headers, data types, and function interfaces required only for the option need not be supplied. An application that attempts to use anything associated only with the option is considered to be requiring an extension.

If a symbolic constant is defined with a value greater than zero, the option shall always be supported when the application is executed. All headers, data types, and functions shall be present and shall operate as specified.

If a symbolic constant is defined with the value zero, all headers, data types, and functions shall be present. The application can check at runtime to see whether the option is supported by calling fpathconf(), pathconf(), or sysconf() with the indicated name parameter.

Unless explicitly specified otherwise, the behavior of functions associated with an unsupported option is unspecified, and an application that uses such functions without first checking fpathconf(), pathconf(), or sysconf() is considered to be requiring an extension.

For conformance requirements, refer to Conformance.

@sbc100
sbc100 requested a review from kripken December 8, 2022 00:12
@sbc100

sbc100 commented Dec 8, 2022

Copy link
Copy Markdown
Collaborator Author

Not worth it actually..

@sbc100 sbc100 closed this Dec 8, 2022
@sbc100
sbc100 deleted the posix_macros branch December 8, 2022 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant