Skip to content

Add missing feature macros#31

Open
Hugal31 wants to merge 1 commit intoAndreaCensi:masterfrom
Hugal31:chore/fix-missing-feature-macros
Open

Add missing feature macros#31
Hugal31 wants to merge 1 commit intoAndreaCensi:masterfrom
Hugal31:chore/fix-missing-feature-macros

Conversation

@Hugal31
Copy link

@Hugal31 Hugal31 commented Jun 9, 2021

We were using some functions (like strdup) without defining the required feature
macros. For instance, strdup requires _POSIX_C_SOURCE >= 200809L, and
vasprintf _GNU_SOURCE. This was causing some SEGFAULT because the functions were
assumed to have the signature int f(), but returned something of a different size (as strdup).

Fix this by defining _DEFAULT_SOURCE (which defines _POSIX_C_SOURCE >= 200809L) and _GNU_SOURCE.

Note: this should not impact the system that doesn't have the impacted functions for the functions we check with CHECK_FUNCTION_EXISTS.

We were using some functions (like strdup) without defining the required feature
macros. For instance, strdup requires `_POSIX_C_SOURCE >= 200809L`, and
vasprintf _GNU_SOURCE. This was causing some SEGFAULT because the functions were
assumed to have the signature `int f()`.

Fix this by defining `_DEFAULT_SOURCE` (which defines `_POSIX_C_SOURCE >=
200809L`) and _GNU_SOURCE.
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