Skip to content

Define _POSIX_C_SOURCE globally and detect supported warnings #402

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

Merged
merged 2 commits into from
Mar 18, 2025

Conversation

emersion
Copy link
Member

Define _POSIX_C_SOURCE globally

Other Sway projects have switched to this approach.

build: use cc.get_supported_arguments() for warnings

Let's not require the C compiler to support specific warnings,
especially if half the flags are used to turn off the warnings
anyways.

Other Sway projects have switched to this approach.
Let's not require the C compiler to support specific warnings,
especially if half the flags are used to turn off the warnings
anyways.
Copy link
Member

@kennylevinsen kennylevinsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kennylevinsen kennylevinsen merged commit f18bc29 into master Mar 18, 2025
1 check passed
@kennylevinsen kennylevinsen deleted the posix-c-source branch March 18, 2025 21:31
@landryb
Copy link

landryb commented Apr 15, 2025

fwiw, on OpenBSD i had to revert this/drop the define from meson.build, as having POSIX_SOURCE defined disables __BSD_VISIBLE, which hides the explicit_bzero() definition used in #325.

@emersion
Copy link
Member Author

#325 is not merged.

bob-beck pushed a commit to openbsd/ports that referenced this pull request Apr 15, 2025
see https://github.com/swaywm/swaylock/releases/tag/v1.8.1
and https://github.com/swaywm/swaylock/releases/tag/v1.8.2

drop -D_POSIX_C_SOURCE=200809L from CFLAGS as it disables __BSD_VISIBLE
which hides explicit_bzero().

cf swaywm/swaylock#402
@landryb
Copy link

landryb commented Apr 15, 2025

#325 is not merged.

i know, it stalled. I'm just saying that this PR creates issues with it :)

@kennylevinsen
Copy link
Member

kennylevinsen commented Apr 15, 2025

which hides the explicit_bzero() definition used in #325.

The OpenBSD backend should use password_buffer_destroy to align with the existing backends, which would solve the issue. When an exception is needed, the file can just undef _POSIX_C_SOURCE.

@landryb
Copy link

landryb commented Apr 15, 2025

@kennylevinsen thanks, that also works. I'll try to unstall #325 someday..

sthen pushed a commit to sthen/ports that referenced this pull request Apr 16, 2025
see https://github.com/swaywm/swaylock/releases/tag/v1.8.1
and https://github.com/swaywm/swaylock/releases/tag/v1.8.2

drop -D_POSIX_C_SOURCE=200809L from CFLAGS as it disables __BSD_VISIBLE
which hides explicit_bzero().

cf swaywm/swaylock#402
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants