|
From: | Thomas Shields |
Subject: | Compilation warnings in regex.c on macOS Mojave with the Homebrew distribution of gcc version 4.9.4_2 |
Date: | Tue, 16 Feb 2021 12:42:41 -0600 |
My configuration is somewhat weird, and this is a very small point given that gcc 4.9 is essentially obsolete and this is only a set of warnings, but it may have other impacts, so I’m reporting it. 1. gcc 4 doesn’t support the preprocessor operator “__has_attribute” 2. Compiling “regex.c” from Gnulib with the macOS Mojave Homebrew distribution gcc 4.9.4_2, my “config.h” (attached) gets included twice, since the Gnulib “libc-config.h” doesn’t have a preprocessor guard. (NOTE: adding a guard should be the easy fix) 3, The 1st time is via “libc-config.h" in “regex.c”, the 2nd time is via "libc-config.h” via “dynarray.h” via “regex_internal.h” 4. After the 1st pass through “config.h” with “__has_attribute" undefined, gcc-4.9 eventually includes “cdefs.h” from the macOS Mojave "Command Line Tools for Xcode 10”, which defines “__has_attribute” as below: #ifndef __has_attribute #define __has_attribute(x) 0 #endif 5. The 2nd pass through “config.h” with “__has_attribute” thus defined then results in a different definition of the “_GL_HAS_ATTRIBUTE” (and related) macros In file included from ./libc-config.h:33:0, from ./dynarray.h:22, from regex_internal.h:36, from regex.c:70: ../config.h:668:0: warning: "_GL_HAS_ATTRIBUTE" redefined # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) ^ In file included from ./libc-config.h:33:0, from regex.c:23: ../config.h:670:0: note: this is the location of the previous definition # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr ^ I’m using a version of Gnulib downloaded from the repository on 2/9/2021 @ 12:54PM CST. My workaround is to add “-D__has_attribute(x)=0” to “AM_CFLAGS” in my Gnulib “Makefile.am”. If you need additional context, just ask. Regards, Tom Shields |
config.h
Description: Binary data
signature.asc
Description: Message signed with OpenPGP
[Prev in Thread] | Current Thread | [Next in Thread] |