summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2020-08-06 09:31:05 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2020-08-06 09:31:05 +0200
commit9595704c19d3ffd0b876d988a062da32dd5fb5fc (patch)
tree0844f2ec8d378ab7dbba057be43347b457483e4b
parentb6ec6ab814fb67d14b018dcee6f7d391eb2c9189 (diff)
downloadcompilertests-9595704c19d3ffd0b876d988a062da32dd5fb5fc.tar.gz
compilertests-9595704c19d3ffd0b876d988a062da32dd5fb5fc.tar.bz2
removed playing with noreturn attribute
-rw-r--r--ecomp-c/asm-i386.c5
-rwxr-xr-xecomp-c/build.sh2
-rw-r--r--ecomp-c/builtin_unreachable.c11
-rw-r--r--ecomp-c/ec.c2
-rw-r--r--ecomp-c/libc-freestanding.c17
5 files changed, 6 insertions, 31 deletions
diff --git a/ecomp-c/asm-i386.c b/ecomp-c/asm-i386.c
index 9b303c8..61f0ff0 100644
--- a/ecomp-c/asm-i386.c
+++ b/ecomp-c/asm-i386.c
@@ -146,12 +146,12 @@ static void Err( char *s, va_list args )
fflush( stderr );
}
-__attribute__((noreturn)) static void Halt( int code )
+static void Halt( int code )
{
exit( code );
}
-__attribute__((noreturn)) static void Abort( char *s, ... )
+static void Abort( char *s, ... )
{
va_list args;
va_start( args, s );
@@ -1197,6 +1197,7 @@ static int evaluateExpression( ExpressionNode *node, int ORG, int LC )
num = left - right;
break;
default:
+ num = 0; /* make clang happy */
Abort( "Unknown operation '%s' in expression", symname[node->op] );
}
return num;
diff --git a/ecomp-c/build.sh b/ecomp-c/build.sh
index 1d7551e..e4d41ec 100755
--- a/ecomp-c/build.sh
+++ b/ecomp-c/build.sh
@@ -62,12 +62,10 @@ case "${COMPILER}:${MODE}" in
;;
pcc:freestanding)
CFLAGS+=" -ffreestanding -nostdlib -Wl,-emain"
- MODULES+=("builtin_unreachable.c")
;;
tcc:freestanding)
CFLAGS+=" -fno-bultin -nostdlib"
MODULES+=("_start-stub.c")
- MODULES+=("builtin_unreachable.c")
;;
*:hosted)
CFLAGS+=" -lbsd"
diff --git a/ecomp-c/builtin_unreachable.c b/ecomp-c/builtin_unreachable.c
deleted file mode 100644
index 0da44f0..0000000
--- a/ecomp-c/builtin_unreachable.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * __builtin_unreachable for pcc/tcc marking exit in
- * libc-freestanding.c syscall1noret
- */
-
-/* break in pcc (is eliminated?!), disable gcc compatibility in pcc
- * OTOH breaks in "i386/code.c:374:36: error: 'GCC_ATYP_STDCALL' undeclared"
- */
-void __builtin_unreachable( void )
-{
-}
diff --git a/ecomp-c/ec.c b/ecomp-c/ec.c
index 82775e0..bc0944e 100644
--- a/ecomp-c/ec.c
+++ b/ecomp-c/ec.c
@@ -133,7 +133,7 @@ static void Err( char *s, va_list args )
fflush( stderr );
}
-__attribute__((noreturn)) static void Halt( int code )
+static void Halt( int code )
{
exit( code );
}
diff --git a/ecomp-c/libc-freestanding.c b/ecomp-c/libc-freestanding.c
index 35f2e02..f37aa83 100644
--- a/ecomp-c/libc-freestanding.c
+++ b/ecomp-c/libc-freestanding.c
@@ -138,19 +138,6 @@ static __attribute__((noinline)) int syscall1( int id, int arg0 )
return retval;
}
-void __builtin_unreachable( void );
-
-static __attribute__((noinline)) __attribute__((noreturn)) void syscall1noret( int id, int arg0 )
-{
- __asm__ volatile( "\
- push %%ebx\n\
- mov %0, %%eax\n\
- mov %1, %%ebx\n\
- int $0x80\n\
- pop %%ebx\n" : : "m"( id ), "m"( arg0 ) );
- __builtin_unreachable( );
-}
-
static __attribute__((noinline)) int syscall3( int id, int arg0, int arg1, int arg2 )
{
int retval;
@@ -177,9 +164,9 @@ static __attribute__((noinline)) int syscall3( int id, int arg0, int arg1, int a
return retval;
}
-__attribute__((noreturn)) void exit( int status )
+void exit( int status )
{
- syscall1noret( SYSCALL_EXIT, status );
+ syscall1( SYSCALL_EXIT, status );
}
static void strreverse( char *s )