For some reason there is no define of __linux on ppc64el :
On ppc64el :
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/powerpc64le-linux-gnu/7/lto-wrapper
Target: powerpc64le-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 7.2.0-1'
--with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-7
--program-prefix=powerpc64le-linux-gnu- --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/
--enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-libquadmath --enable-plugin --enable-default-pie --with-system-zlib
--enable-objc-gc=auto --enable-secureplt --with-cpu=power8
--enable-targets=powerpcle-linux --disable-multilib --enable-multiarch
--disable-werror --with-long-double-128 --enable-checking=release
--build=powerpc64le-linux-gnu --host=powerpc64le-linux-gnu
--target=powerpc64le-linux-gnu
Thread model: posix
gcc version 7.2.0 (Debian 7.2.0-1)
$ echo | gcc -dM -E -|grep linux
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1
#define linux 1
$ echo | gcc -std=c++14 -dM -E -|grep linux
cc1: warning: command line option ‘-std=c++14’ is valid for C++/ObjC++ but not
for C
#define __linux__ 1
#define __gnu_linux__ 1
also :
$ echo | gcc-6 -std=c++14 -dM -E -|grep linux
cc1: warning: command line option ‘-std=c++14’ is valid for C++/ObjC++ but not
for C
#define __linux__ 1
#define __gnu_linux__ 1
On amd64 :
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 7.2.0-1'
--with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-7
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib --enable-objc-gc=auto
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-
linux-gn
u --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Debian 7.2.0-1)
$ echo | gcc -dM -E -|grep linux
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1
#define linux 1
$ echo | gcc -std=c++14 -dM -E -|grep linux
cc1: warning: command line option ‘-std=c++14’ is valid for C++/ObjC++ but not
for C
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1
#define linux 1
$ echo | gcc-6 -std=c++14 -dM -E -|grep linux
cc1: warning: command line option ‘-std=c++14’ is valid for C++/ObjC++ but not
for C
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1
#define linux 1
Previous version of contextfree didn't use that new code.
It seems like this is still an unclear behaviour of gcc :
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69473
I'd advise to move to __linux__ which the attached patch does.
F.
Description: Fix undefined macro on powerpc
On powerpc and maybe some other architecture, __linux macro is not defined :
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69473
Just use __linux__ instead
Author: Frédéric Bonnard
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69473
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: contextfree-3.0.11.4+dfsg1/src-unix/posixSystem.cpp
===
--- contextfree-3.0.11.4+dfsg1.orig/src-unix/posixSystem.cpp2017-08-13
19:25:02.0 +
+++ contextfree-3.0.11.4+dfsg1/src-unix/posixSystem.cpp 2017-08-21
11:45:39.789635483 +
@@ -232,7 +232,7 @@
size_t
PosixSystem::getPhysicalMemory()
{
-#ifdef __linux
+#ifdef __linux__
#if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
uint64_t size = sysconf(_SC_PHYS_PAGES) *
static_cast(sysconf(_SC_PAGESIZE));
if (size > MaximumMemory)
@@ -241,7 +241,7 @@
#else
return 0;
#endif
-#else // __linux
+#else // __linux__
int mib[2];
mib[0] = CTL_HW;
#if defined(HW_MEMSIZE)
@@ -267,6 +267,6 @@
return static_cast(size);
}
return 0;
-#endif //