Skip to content
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

Inclusion of sysmacros.h by types.h is deprecated. #2907

Merged
merged 3 commits into from
Sep 27, 2017

Conversation

ekigwana
Copy link
Contributor

Release notes for glibc-2.25 state:

The inclusion of <sys/sysmacros.h> by <sys/types.h> is deprecated.
This means that in a future release, the macros “major”, “minor”, and
“makedev” will only be available from <sys/sysmacros.h>.

These macros are not part of POSIX nor XSI, and their names frequently
collide with user code; see for instance glibc bug 19239 and Red Hat
bug 130601. <stdlib.h> includes <sys/types.h> under _GNU_SOURCE, and
C++ code presently cannot avoid being compiled under _GNU_SOURCE,
exacerbating the problem.

evalfunction.c: In function ‘FnCallFileStatDetails’:
evalfunction.c:3191:64: error: implicit declaration of function ‘minor’; did you mean ‘mknod’? [-Werror=implicit-function-declaration]
snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) minor(statbuf.st_dev) );
^~~~~
mknod
evalfunction.c:3199:64: error: implicit declaration of function ‘major’ [-Werror=implicit-function-declaration]
snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) major(statbuf.st_dev) );

Release notes for glibc-2.25 state:

The inclusion of <sys/sysmacros.h> by <sys/types.h> is deprecated.
This means that in a future release, the macros “major”, “minor”, and
“makedev” will only be available from <sys/sysmacros.h>.

These macros are not part of POSIX nor XSI, and their names frequently
collide with user code; see for instance glibc bug 19239 and Red Hat
bug 130601. <stdlib.h> includes <sys/types.h> under _GNU_SOURCE, and
C++ code presently cannot avoid being compiled under _GNU_SOURCE,
exacerbating the problem.

evalfunction.c: In function ‘FnCallFileStatDetails’:
evalfunction.c:3191:64: error: implicit declaration of function ‘minor’; did you mean ‘mknod’? [-Werror=implicit-function-declaration]
             snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) minor(statbuf.st_dev) );
                                                                ^~~~~
                                                                mknod
evalfunction.c:3199:64: error: implicit declaration of function ‘major’ [-Werror=implicit-function-declaration]
             snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) major(statbuf.st_dev) );
@jimis
Copy link
Contributor

jimis commented Sep 18, 2017

Thanks, I'm running this on all platforms on our CI. I have a feeling that this will fail, because the inclusion needs to be guarder with #ifdef HAVE_SYS_SYSMACROS_H, and a check AC_CHECK_HEADERS_ONCE([sys/sysmacros.h]) needs to be added to configure.ac. We'll see.

EDIT: see here

@jimis
Copy link
Contributor

jimis commented Sep 19, 2017

Indeed MinGW build failed with:

../../libutils/platform.h:82:27: fatal error: sys/sysmacros.h: No such file or directory

Copy link
Contributor

@jimis jimis left a comment

Choose a reason for hiding this comment

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

It should be conditionally included to ensure we don't break platforms that are lacking the header file.

@jimis jimis self-assigned this Sep 19, 2017
@ekigwana
Copy link
Contributor Author

ekigwana commented Sep 26, 2017

@jimis That should do it.

@jimis
Copy link
Contributor

jimis commented Sep 27, 2017

Green in all platforms, thanks!

@jimis jimis merged commit f7d5832 into cfengine:master Sep 27, 2017
jimis pushed a commit that referenced this pull request Sep 27, 2017
Inclusion of sysmacros.h by types.h is deprecated.

Release notes for glibc-2.25 state:

The inclusion of <sys/sysmacros.h> by <sys/types.h> is deprecated.
This means that in a future release, the macros “major”, “minor”, and
“makedev” will only be available from <sys/sysmacros.h>.

These macros are not part of POSIX nor XSI, and their names frequently
collide with user code; see for instance glibc bug 19239 and Red Hat
bug 130601. <stdlib.h> includes <sys/types.h> under _GNU_SOURCE, and
C++ code presently cannot avoid being compiled under _GNU_SOURCE,
exacerbating the problem.

evalfunction.c: In function ‘FnCallFileStatDetails’:
evalfunction.c:3191:64: error: implicit declaration of function ‘minor’; did you mean ‘mknod’? [-Werror=implicit-function-declaration]
             snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) minor(statbuf.st_dev) );
                                                                ^~~~~
                                                                mknod
evalfunction.c:3199:64: error: implicit declaration of function ‘major’ [-Werror=implicit-function-declaration]
             snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) major(statbuf.st_dev) );

(cherry picked from commit f7d5832)
jimis pushed a commit that referenced this pull request Sep 27, 2017
Inclusion of sysmacros.h by types.h is deprecated.

Release notes for glibc-2.25 state:

The inclusion of <sys/sysmacros.h> by <sys/types.h> is deprecated.
This means that in a future release, the macros “major”, “minor”, and
“makedev” will only be available from <sys/sysmacros.h>.

These macros are not part of POSIX nor XSI, and their names frequently
collide with user code; see for instance glibc bug 19239 and Red Hat
bug 130601. <stdlib.h> includes <sys/types.h> under _GNU_SOURCE, and
C++ code presently cannot avoid being compiled under _GNU_SOURCE,
exacerbating the problem.

evalfunction.c: In function ‘FnCallFileStatDetails’:
evalfunction.c:3191:64: error: implicit declaration of function ‘minor’; did you mean ‘mknod’? [-Werror=implicit-function-declaration]
             snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) minor(statbuf.st_dev) );
                                                                ^~~~~
                                                                mknod
evalfunction.c:3199:64: error: implicit declaration of function ‘major’ [-Werror=implicit-function-declaration]
             snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) major(statbuf.st_dev) );

(cherry picked from commit f7d5832)
jimis pushed a commit that referenced this pull request Sep 27, 2017
Inclusion of sysmacros.h by types.h is deprecated.

Release notes for glibc-2.25 state:

The inclusion of <sys/sysmacros.h> by <sys/types.h> is deprecated.
This means that in a future release, the macros “major”, “minor”, and
“makedev” will only be available from <sys/sysmacros.h>.

These macros are not part of POSIX nor XSI, and their names frequently
collide with user code; see for instance glibc bug 19239 and Red Hat
bug 130601. <stdlib.h> includes <sys/types.h> under _GNU_SOURCE, and
C++ code presently cannot avoid being compiled under _GNU_SOURCE,
exacerbating the problem.

evalfunction.c: In function ‘FnCallFileStatDetails’:
evalfunction.c:3191:64: error: implicit declaration of function ‘minor’; did you mean ‘mknod’? [-Werror=implicit-function-declaration]
             snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) minor(statbuf.st_dev) );
                                                                ^~~~~
                                                                mknod
evalfunction.c:3199:64: error: implicit declaration of function ‘major’ [-Werror=implicit-function-declaration]
             snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) major(statbuf.st_dev) );

(cherry picked from commit f7d5832)
craigcomstock pushed a commit to craigcomstock/core that referenced this pull request Jul 24, 2024
Inclusion of sysmacros.h by types.h is deprecated.

Release notes for glibc-2.25 state:

The inclusion of <sys/sysmacros.h> by <sys/types.h> is deprecated.
This means that in a future release, the macros “major”, “minor”, and
“makedev” will only be available from <sys/sysmacros.h>.

These macros are not part of POSIX nor XSI, and their names frequently
collide with user code; see for instance glibc bug 19239 and Red Hat
bug 130601. <stdlib.h> includes <sys/types.h> under _GNU_SOURCE, and
C++ code presently cannot avoid being compiled under _GNU_SOURCE,
exacerbating the problem.

evalfunction.c: In function ‘FnCallFileStatDetails’:
evalfunction.c:3191:64: error: implicit declaration of function ‘minor’; did you mean ‘mknod’? [-Werror=implicit-function-declaration]
             snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) minor(statbuf.st_dev) );
                                                                ^~~~~
                                                                mknod
evalfunction.c:3199:64: error: implicit declaration of function ‘major’ [-Werror=implicit-function-declaration]
             snprintf(buffer, CF_MAXVARSIZE, "%jd", (uintmax_t) major(statbuf.st_dev) );

(cherry picked from commit f7d5832)
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.

2 participants