Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[musl] Fix __GLIBC__ tests. JB#49555
The __GLIBC__ macro gets defined when some suitable libc header file is included. Thus such test will produce false negatives if performed before including appropriate headers. Move all musl-libc compatibility handling to occur after all other header files have been included. In case of unique tests, make sure there is #include <features.h> before the ifdef test. And in case of musl-compatibility.h - which is included from multiple places - move the testing within the header to avoid copy paste tests. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
- Loading branch information
Showing
8 changed files
with
51 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,9 +1,28 @@ | ||
/* Used to retry syscalls that can return EINTR. Taken from bionic unistd.h */ | ||
#ifndef TEMP_FAILURE_RETRY | ||
#define TEMP_FAILURE_RETRY(exp) ({ \ | ||
#ifndef DSME_MUSL_COMPATIBILITY_H_ | ||
# define DSME_MUSL_COMPATIBILITY_H_ | ||
|
||
/* Whether __GLIBC__ gets defined when compiling against gnu libc, | ||
* depends on what - if any - libc header files have been included | ||
* so far. To be sure, include features.h that contains the define. | ||
*/ | ||
# include <features.h> | ||
|
||
/* Define equivalents for glibc macros that dsme sources are using, | ||
* but are not defined in musl libc headers. | ||
*/ | ||
# ifndef __GLIBC__ | ||
|
||
/* Used to retry syscalls that can return EINTR. Taken from bionic unistd.h | ||
*/ | ||
# ifndef TEMP_FAILURE_RETRY | ||
# define TEMP_FAILURE_RETRY(exp) ({ \ | ||
__typeof__(exp) _rc; \ | ||
do { \ | ||
_rc = (exp); \ | ||
} while (_rc == -1 && errno == EINTR); \ | ||
_rc; }) | ||
#endif | ||
# endif | ||
|
||
# endif /* not __GLIBC__ */ | ||
|
||
#endif /* DSME_MUSL_COMPATIBILITY_H_ */ |
This file contains 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 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 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 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 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