From 951b36824dd8f4a460ed31ccbbc322482a06ba80 Mon Sep 17 00:00:00 2001 From: Moritz Kroll Date: Thu, 31 Jul 2008 19:27:28 +0000 Subject: [PATCH] testcase: __inline__ declaration without implementation aborts cparser [r20858] --- parsetest/cp_error037.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 parsetest/cp_error037.c diff --git a/parsetest/cp_error037.c b/parsetest/cp_error037.c new file mode 100644 index 0000000..57f61ab --- /dev/null +++ b/parsetest/cp_error037.c @@ -0,0 +1,29 @@ +// Aus CygWin's /usr/include/asm/byteorder.h zusammenkopiert +// Es gibt keine weitere Definition von __constant_ntohl + +typedef unsigned long uint32_t; + +extern __inline__ uint32_t __ntohl(uint32_t); +extern __inline__ uint32_t __constant_ntohl(uint32_t); + +extern __inline__ uint32_t +__ntohl(uint32_t x) +{ + __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ + "rorl $16,%0\n\t" /* swap words */ + "xchgb %b0,%h0" /* swap higher bytes */ + :"=q" (x) + : "0" (x)); + return x; +} + +#define __constant_ntohl(x) \ + ((uint32_t)((((uint32_t)(x) & 0x000000ffU) << 24) | \ + (((uint32_t)(x) & 0x0000ff00U) << 8) | \ + (((uint32_t)(x) & 0x00ff0000U) >> 8) | \ + (((uint32_t)(x) & 0xff000000U) >> 24))) + +int main(void) +{ + return 0; +} -- 2.20.1