glibc/sysdeps/microblaze/bits/atomic.h: Avoid include recursion to cause compiling break
diff mbox

Message ID 541E883C.1020600@gmail.com
State New
Headers show

Commit Message

Chen Gang Sept. 21, 2014, 8:11 a.m. UTC
The related definitions are in 'atomic.h', which also need include
'lowlevellock.h', which also need the related functions in 'atomic.h'.

The related configuration:

  ../glibc/configure  --prefix /upstream/release/ \
    --target=microblaze-linux-gnu --with-headers=/upstream/release/kernel \
    --host=microblaze-linux-gnu

  [root@localhost build-glibc]# cat configparms
  CC=/usr/local/bin/microblaze-gchen-linux-gcc
  BUILD_CC=gcc
  LD=/usr/local/bin/microblaze-gchen-linux-ld
  NM=/usr/local/bin/microblaze-gchen-linux-nm
  AS=/usr/local/bin/microblaze-gchen-linux-as
  AR=/usr/local/bin/microblaze-gchen-linux-ar
  RANLIB=/usr/local/bin/microblaze-gchen-linux-ranlib

The related error:

  /usr/local/bin/microblaze-gchen-linux-gcc assert.c -c -std=gnu99 -fgnu89-inline  -O2 -Wall -Winline -Wundef -Wwrite-strings -fmerge-all-constants -frounding-math -g -Wstrict-prototypes -Werror=implicit-function-declaration   -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>'       -I../include -I/upstream/build-glibc/assert  -I/upstream/build-glibc  -I../sysdeps/unix/sysv/linux/microblaze  -I../sysdeps/microblaze/nptl  -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/microblaze  -I../sysdeps/wordsize-32  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.3/include -isystem /upstream/release/kernel  -D_LIBC_REENTRANT -include ../include/libc-symbols.h       -o /upstream/build-glibc/assert/assert.o -MD -MP -MF /upstream/build-gli
bc/assert/assert.o.dt -MT /upstream/build-glibc/assert/assert.o
  In file included from ../nptl/descr.h:30:0,
                   from ../sysdeps/microblaze/nptl/tls.h:54,
                   from ../include/errno.h:27,
                   from ../sysdeps/unix/sysv/linux/microblaze/sysdep.h:27,
                   from ../sysdeps/microblaze/bits/atomic.h:20,
                   from ../include/atomic.h:50,
                   from assert.c:19:
  ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: In function '__lll_cond_lock':
  ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h:208:27: error: implicit declaration of function 'atomic_exchange_acq' [-Werror=implicit-function-declaration]
       if (__builtin_expect (atomic_exchange_acq (futex, 2), 0))
                             ^
  ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: In function '__lll_timedlock':
  ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h:226:25: error: implicit declaration of function 'atomic_compare_and_exchange_val_acq' [-Werror=implicit-function-declaration]
     if (__builtin_expect (atomic_compare_and_exchange_val_acq (futex, 1, 0), 0) != 0)
                           ^
  ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: In function '__lll_robust_timedlock':
  ../sysdeps/unix/sysv/linux/microblaze/lowlevellock.h:238:25: error: implicit declaration of function 'atomic_compare_and_exchange_bool_acq' [-Werror=implicit-function-declaration]
     if (__builtin_expect (atomic_compare_and_exchange_bool_acq (futex, id, 0), 0))
                         ^
  cc1: some warnings being treated as errors


Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 sysdeps/microblaze/bits/atomic.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/sysdeps/microblaze/bits/atomic.h b/sysdeps/microblaze/bits/atomic.h
index 77004a0..c8d8d9c 100644
--- a/sysdeps/microblaze/bits/atomic.h
+++ b/sysdeps/microblaze/bits/atomic.h
@@ -17,7 +17,6 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 #include <stdint.h>
-#include <sysdep.h>
 
 
 typedef int8_t atomic8_t;
@@ -267,3 +266,13 @@  typedef uintmax_t uatomic_max_t;
   })
 
 #define atomic_decrement(mem) ({ atomic_decrement_val (mem); (void) 0; })
+
+#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+  ({ /* Cannot use __oldval here, because macros later in this file might     \
+        call this macro with __oldval argument.  */                           \
+     __typeof (oldval) __atg3_old = (oldval);                                 \
+     atomic_compare_and_exchange_val_acq (mem, newval, __atg3_old)            \
+       != __atg3_old;                                                         \
+  })
+
+#include <sysdep.h>