Project

General

Profile

Bug #2646

gmxapi uses major() and minor() which clashes with deprecated glibc macros

Added by Mark Abraham 9 months ago. Updated 9 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
api
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

compiler: clang-6.0.0
glibc: 2.27-3ubuntu1

In file included from ../src/api/cpp/version.cpp:38:
src/api/cpp/include/gmxapi/version.h:110:26: warning: In the GNU C Library, "major" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "major", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "major", you should undefine it after including <sys/types.h>. [-W#pragma-messages]
        static version_t major();
                         ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:101:21: note: expanded from macro 'major'
# define major(dev) __SYSMACROS_DM (major) gnu_dev_major (dev)
                    ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:52:32: note: expanded from macro '__SYSMACROS_DM'
#define __SYSMACROS_DM(symbol) __SYSMACROS_DM1 \
                               ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:62:30: note: expanded from macro '__SYSMACROS_DM1'
#define __SYSMACROS_DM1(...) __glibc_macro_warning (#__VA_ARGS__)
                             ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:470:3: note: expanded from macro '__glibc_macro_warning'
  __glibc_macro_warning1 (GCC warning message)
  ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:468:42: note: expanded from macro '__glibc_macro_warning1'
# define __glibc_macro_warning1(message) _Pragma (#message)
                                         ^
<scratch space>:3:6: note: expanded from here
 GCC warning "In the GNU C Library, \"major\" is defined\n by <sys/sysmacros.h>. For historical compatibility, it is\n currently defined by <sys/types.h> as well, but we plan to\n remove this soon. To use \"major\", include <sys/sysmacros.h>\n directly. If you did not intend to use a system-defined macro\n \"major\", you should undefine it after including <sys/types.h>." 
     ^
In file included from ../src/api/cpp/version.cpp:38:
src/api/cpp/include/gmxapi/version.h:116:26: warning: In the GNU C Library, "minor" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "minor", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including <sys/types.h>. [-W#pragma-messages]
        static version_t minor();
                         ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:102:21: note: expanded from macro 'minor'
# define minor(dev) __SYSMACROS_DM (minor) gnu_dev_minor (dev)
                    ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:52:32: note: expanded from macro '__SYSMACROS_DM'
#define __SYSMACROS_DM(symbol) __SYSMACROS_DM1 \
                               ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:62:30: note: expanded from macro '__SYSMACROS_DM1'
#define __SYSMACROS_DM1(...) __glibc_macro_warning (#__VA_ARGS__)
                             ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:470:3: note: expanded from macro '__glibc_macro_warning'
  __glibc_macro_warning1 (GCC warning message)
  ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:468:42: note: expanded from macro '__glibc_macro_warning1'
# define __glibc_macro_warning1(message) _Pragma (#message)
                                         ^
<scratch space>:8:6: note: expanded from here
 GCC warning "In the GNU C Library, \"minor\" is defined\n by <sys/sysmacros.h>. For historical compatibility, it is\n currently defined by <sys/types.h> as well, but we plan to\n remove this soon. To use \"minor\", include <sys/sysmacros.h>\n directly. If you did not intend to use a system-defined macro\n \"minor\", you should undefine it after including <sys/types.h>." 
     ^
../src/api/cpp/version.cpp:43:20: warning: In the GNU C Library, "major" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "major", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "major", you should undefine it after including <sys/types.h>. [-W#pragma-messages]
version_t Version::major()
                   ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:101:21: note: expanded from macro 'major'
# define major(dev) __SYSMACROS_DM (major) gnu_dev_major (dev)
                    ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:52:32: note: expanded from macro '__SYSMACROS_DM'
#define __SYSMACROS_DM(symbol) __SYSMACROS_DM1 \
                               ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:62:30: note: expanded from macro '__SYSMACROS_DM1'
#define __SYSMACROS_DM1(...) __glibc_macro_warning (#__VA_ARGS__)
                             ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:470:3: note: expanded from macro '__glibc_macro_warning'
  __glibc_macro_warning1 (GCC warning message)
  ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:468:42: note: expanded from macro '__glibc_macro_warning1'
# define __glibc_macro_warning1(message) _Pragma (#message)
                                         ^
<scratch space>:13:6: note: expanded from here
 GCC warning "In the GNU C Library, \"major\" is defined\n by <sys/sysmacros.h>. For historical compatibility, it is\n currently defined by <sys/types.h> as well, but we plan to\n remove this soon. To use \"major\", include <sys/sysmacros.h>\n directly. If you did not intend to use a system-defined macro\n \"major\", you should undefine it after including <sys/types.h>." 
     ^
../src/api/cpp/version.cpp:48:20: warning: In the GNU C Library, "minor" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "minor", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including <sys/types.h>. [-W#pragma-messages]
version_t Version::minor()
                   ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:102:21: note: expanded from macro 'minor'
# define minor(dev) __SYSMACROS_DM (minor) gnu_dev_minor (dev)
                    ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:52:32: note: expanded from macro '__SYSMACROS_DM'
#define __SYSMACROS_DM(symbol) __SYSMACROS_DM1 \
                               ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:62:30: note: expanded from macro '__SYSMACROS_DM1'
#define __SYSMACROS_DM1(...) __glibc_macro_warning (#__VA_ARGS__)
                             ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:470:3: note: expanded from macro '__glibc_macro_warning'
  __glibc_macro_warning1 (GCC warning message)
  ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:468:42: note: expanded from macro '__glibc_macro_warning1'
# define __glibc_macro_warning1(message) _Pragma (#message)
                                         ^
<scratch space>:2:6: note: expanded from here
 GCC warning "In the GNU C Library, \"minor\" is defined\n by <sys/sysmacros.h>. For historical compatibility, it is\n currently defined by <sys/types.h> as well, but we plan to\n remove this soon. To use \"minor\", include <sys/sysmacros.h>\n directly. If you did not intend to use a system-defined macro\n \"minor\", you should undefine it after including <sys/types.h>." 
     ^
../src/api/cpp/version.cpp:75:18: warning: In the GNU C Library, "major" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "major", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "major", you should undefine it after including <sys/types.h>. [-W#pragma-messages]
    if (Version::major() < major)
                 ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:101:21: note: expanded from macro 'major'
# define major(dev) __SYSMACROS_DM (major) gnu_dev_major (dev)
                    ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:52:32: note: expanded from macro '__SYSMACROS_DM'
#define __SYSMACROS_DM(symbol) __SYSMACROS_DM1 \
                               ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:62:30: note: expanded from macro '__SYSMACROS_DM1'
#define __SYSMACROS_DM1(...) __glibc_macro_warning (#__VA_ARGS__)
                             ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:470:3: note: expanded from macro '__glibc_macro_warning'
  __glibc_macro_warning1 (GCC warning message)
  ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:468:42: note: expanded from macro '__glibc_macro_warning1'
# define __glibc_macro_warning1(message) _Pragma (#message)
                                         ^
<scratch space>:7:6: note: expanded from here
 GCC warning "In the GNU C Library, \"major\" is defined\n by <sys/sysmacros.h>. For historical compatibility, it is\n currently defined by <sys/types.h> as well, but we plan to\n remove this soon. To use \"major\", include <sys/sysmacros.h>\n directly. If you did not intend to use a system-defined macro\n \"major\", you should undefine it after including <sys/types.h>." 
     ^
../src/api/cpp/version.cpp:79:18: warning: In the GNU C Library, "major" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "major", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "major", you should undefine it after including <sys/types.h>. [-W#pragma-messages]
    if (Version::major() > major)
                 ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:101:21: note: expanded from macro 'major'
# define major(dev) __SYSMACROS_DM (major) gnu_dev_major (dev)
                    ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:52:32: note: expanded from macro '__SYSMACROS_DM'
#define __SYSMACROS_DM(symbol) __SYSMACROS_DM1 \
                               ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:62:30: note: expanded from macro '__SYSMACROS_DM1'
#define __SYSMACROS_DM1(...) __glibc_macro_warning (#__VA_ARGS__)
                             ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:470:3: note: expanded from macro '__glibc_macro_warning'
  __glibc_macro_warning1 (GCC warning message)
  ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:468:42: note: expanded from macro '__glibc_macro_warning1'
# define __glibc_macro_warning1(message) _Pragma (#message)
                                         ^
<scratch space>:12:6: note: expanded from here
 GCC warning "In the GNU C Library, \"major\" is defined\n by <sys/sysmacros.h>. For historical compatibility, it is\n currently defined by <sys/types.h> as well, but we plan to\n remove this soon. To use \"major\", include <sys/sysmacros.h>\n directly. If you did not intend to use a system-defined macro\n \"major\", you should undefine it after including <sys/types.h>." 
     ^
../src/api/cpp/version.cpp:83:18: warning: In the GNU C Library, "minor" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "minor", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including <sys/types.h>. [-W#pragma-messages]
    if (Version::minor() < minor)
                 ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:102:21: note: expanded from macro 'minor'
# define minor(dev) __SYSMACROS_DM (minor) gnu_dev_minor (dev)
                    ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:52:32: note: expanded from macro '__SYSMACROS_DM'
#define __SYSMACROS_DM(symbol) __SYSMACROS_DM1 \
                               ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:62:30: note: expanded from macro '__SYSMACROS_DM1'
#define __SYSMACROS_DM1(...) __glibc_macro_warning (#__VA_ARGS__)
                             ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:470:3: note: expanded from macro '__glibc_macro_warning'
  __glibc_macro_warning1 (GCC warning message)
  ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:468:42: note: expanded from macro '__glibc_macro_warning1'
# define __glibc_macro_warning1(message) _Pragma (#message)
                                         ^
<scratch space>:17:6: note: expanded from here
 GCC warning "In the GNU C Library, \"minor\" is defined\n by <sys/sysmacros.h>. For historical compatibility, it is\n currently defined by <sys/types.h> as well, but we plan to\n remove this soon. To use \"minor\", include <sys/sysmacros.h>\n directly. If you did not intend to use a system-defined macro\n \"minor\", you should undefine it after including <sys/types.h>." 
     ^
../src/api/cpp/version.cpp:87:18: warning: In the GNU C Library, "minor" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "minor", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including <sys/types.h>. [-W#pragma-messages]
    if (Version::minor() > minor)
                 ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:102:21: note: expanded from macro 'minor'
# define minor(dev) __SYSMACROS_DM (minor) gnu_dev_minor (dev)
                    ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:52:32: note: expanded from macro '__SYSMACROS_DM'
#define __SYSMACROS_DM(symbol) __SYSMACROS_DM1 \
                               ^
/usr/include/x86_64-linux-gnu/sys/sysmacros.h:62:30: note: expanded from macro '__SYSMACROS_DM1'
#define __SYSMACROS_DM1(...) __glibc_macro_warning (#__VA_ARGS__)
                             ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:470:3: note: expanded from macro '__glibc_macro_warning'
  __glibc_macro_warning1 (GCC warning message)
  ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:468:42: note: expanded from macro '__glibc_macro_warning1'
# define __glibc_macro_warning1(message) _Pragma (#message)
                                         ^
<scratch space>:4:6: note: expanded from here
 GCC warning "In the GNU C Library, \"minor\" is defined\n by <sys/sysmacros.h>. For historical compatibility, it is\n currently defined by <sys/types.h> as well, but we plan to\n remove this soon. To use \"minor\", include <sys/sysmacros.h>\n directly. If you did not intend to use a system-defined macro\n \"minor\", you should undefine it after including <sys/types.h>." 
     ^
8 warnings generated.

Offhand, we should probably rename to majorVersion() et al.

Associated revisions

Revision 7569e5f1 (diff)
Added by Eric Irrgang 9 months ago

Change names of gmxapi::Version functions.

major() and minor() member functions clash with a historical macro,
producing compiler warnings. Change names to majorVersion(), etc.

Fixes #2646

Change-Id: I568ab1dc216b200b182b34f76016fbfa54015dbd

History

#1 Updated by Mark Abraham 9 months ago

  • Category set to api

#2 Updated by Gerrit Code Review Bot 9 months ago

Gerrit received a related patchset '1' for Issue #2646.
Uploader: M. Eric Irrgang ()
Change-Id: gromacs~master~I568ab1dc216b200b182b34f76016fbfa54015dbd
Gerrit URL: https://gerrit.gromacs.org/8376

#3 Updated by Eric Irrgang 9 months ago

  • Status changed from New to Fix uploaded

Is this a build configuration in the Jenkins matrix tests? How should we confirm that the patch I submitted is a solution?

#4 Updated by Mark Abraham 9 months ago

Eric Irrgang wrote:

Is this a build configuration in the Jenkins matrix tests? How should we confirm that the patch I submitted is a solution?

I tested it manually on the same machine and voted verify +1 on Gerrit

#5 Updated by Eric Irrgang 9 months ago

  • Status changed from Fix uploaded to Resolved

#6 Updated by Mark Abraham 9 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF