Skip to content

Commit cd33456

Browse files
committed
change asm to __asm__ to support cc's --std=c99 flag (from issue #16, proposed by Theo Schlossnagle @postwait)
1 parent ecac993 commit cd33456

File tree

5 files changed

+33
-17
lines changed

5 files changed

+33
-17
lines changed

.travis.yml

+11
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ script:
1616
- if [ "$TRAVIS_OS_NAME" = "osx" ] ; then brew install gnu-sed --with-default-names; fi
1717
- if [ "$TRAVIS_OS_NAME" = "linux" ] ; then sudo apt-get install -qq -y libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make build-essential valgrind gcc-multilib g++-multilib libc6-dbg libc6-dbg:i386 ; fi
1818
- date
19+
- export EXTRA_CFLAGS=""
1920
- echo ""
2021
- bash test.sh version_check=1.2.3
2122
- echo ""
@@ -26,6 +27,16 @@ script:
2627
- mkdir output ; bash make.sh -o no-valgrind ; ls output ; ls output | wc -l ; cd output ; bash ../test.sh ; cd .. ; rm -fr output
2728
- echo ""
2829
- if [ "$TRAVIS_OS_NAME" = "linux" ] ; then mkdir output ; bash make.sh -o no-valgrind -o no-m32 ; ls output ; ls output | wc -l ; cd output ; bash ../test.sh ; cd .. ; rm -fr output; fi
30+
- echo ""
31+
- export EXTRA_CFLAGS="--std=c99"
32+
- echo ""
33+
- if [ "$TRAVIS_OS_NAME" = "linux" ] ; then mkdir output ; bash make.sh ; ls output ; ls output | wc -l ; cd output ; bash ../test.sh ; cd .. ; rm -fr output; fi
34+
- echo ""
35+
- if [ "$TRAVIS_OS_NAME" = "linux" ] ; then mkdir output ; bash make.sh -o no-m32 ; ls output ; ls output | wc -l ; cd output ; bash ../test.sh ; cd .. ; rm -fr output; fi
36+
- echo ""
37+
- mkdir output ; bash make.sh -o no-valgrind ; ls output ; ls output | wc -l ; cd output ; bash ../test.sh ; cd .. ; rm -fr output
38+
- echo ""
39+
- if [ "$TRAVIS_OS_NAME" = "linux" ] ; then mkdir output ; bash make.sh -o no-valgrind -o no-m32 ; ls output ; ls output | wc -l ; cd output ; bash ../test.sh ; cd .. ; rm -fr output; fi
2940
- echo "" ; date
3041

3142
matrix:

aco.c

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#define _GNU_SOURCE
16+
1517
#include "aco.h"
1618
#include <stdio.h>
1719
#include <stdint.h>

aco.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ extern void aco_runtime_test(void);
159159

160160
extern void aco_thread_init(aco_cofuncp_t last_word_co_fp);
161161

162-
extern void* acosw(aco_t* from_co, aco_t* to_co) asm("acosw"); // asm
162+
extern void* acosw(aco_t* from_co, aco_t* to_co) __asm__("acosw"); // asm
163163

164-
extern void aco_save_fpucw_mxcsr(void* p) asm("aco_save_fpucw_mxcsr"); // asm
164+
extern void aco_save_fpucw_mxcsr(void* p) __asm__("aco_save_fpucw_mxcsr"); // asm
165165

166-
extern void aco_funcp_protector_asm(void) asm("aco_funcp_protector_asm"); // asm
166+
extern void aco_funcp_protector_asm(void) __asm__("aco_funcp_protector_asm"); // asm
167167

168168
extern void aco_funcp_protector(void);
169169

make.sh

+15-14
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
OUTPUT_DIR="./output"
1616
CFLAGS="-g -O2 -Wall -Werror"
17-
EXTRA_CFLAGS=""
17+
#EXTRA_CFLAGS=""
1818
OUTPUT_SUFFIX=""
1919
makecc="cc"
2020
if [ "$CC" ]
@@ -71,10 +71,11 @@ function build_f(){
7171
declare build_cmd
7272
declare tmp_ret
7373
declare skip_flag
74-
echo "OUTPUT_DIR: $OUTPUT_DIR"
75-
echo "CFLAGS: $CFLAGS"
76-
echo "EXTRA_CFLAGS: $EXTRA_CFLAGS"
77-
echo "OUTPUT_SUFFIX: $OUTPUT_SUFFIX"
74+
echo "OUTPUT_DIR: $OUTPUT_DIR"
75+
echo "CFLAGS: $CFLAGS"
76+
echo "EXTRA_CFLAGS: $EXTRA_CFLAGS"
77+
echo "ACO_EXTRA_CFLAGS: $ACO_EXTRA_CFLAGS"
78+
echo "OUTPUT_SUFFIX: $OUTPUT_SUFFIX"
7879
echo "$app_list" | grep -Po '.+$' | while read read_in
7980
do
8081
file=`echo $read_in | grep -Po "^[^\s]+"`
@@ -84,7 +85,7 @@ function build_f(){
8485
continue
8586
fi
8687
#echo "<$file>:<$cflags>:$OUTPUT_DIR:$CFLAGS:$EXTRA_CFLAGS:$OUTPUT_SUFFIX"
87-
build_cmd="$makecc $CFLAGS $EXTRA_CFLAGS acosw.S aco.c $file.c $cflags -o $OUTPUT_DIR/$file$OUTPUT_SUFFIX"
88+
build_cmd="$makecc $CFLAGS $ACO_EXTRA_CFLAGS $EXTRA_CFLAGS acosw.S aco.c $file.c $cflags -o $OUTPUT_DIR/$file$OUTPUT_SUFFIX"
8889
skip_flag=""
8990
if [ "$gl_opt_no_m32" ]
9091
then
@@ -182,18 +183,18 @@ tra "echo;echo build has been interrupted"
182183
# the matrix of the build config for later testing
183184
# -m32 -DACO_CONFIG_SHARE_FPU_MXCSR_ENV -DACO_USE_VALGRIND
184185
# 0 0 0
185-
EXTRA_CFLAGS="" OUTPUT_SUFFIX="..no_valgrind.standaloneFPUenv" build_f
186+
ACO_EXTRA_CFLAGS="" OUTPUT_SUFFIX="..no_valgrind.standaloneFPUenv" build_f
186187
# 0 0 1
187-
EXTRA_CFLAGS="-DACO_USE_VALGRIND" OUTPUT_SUFFIX="..valgrind.standaloneFPUenv" build_f
188+
ACO_EXTRA_CFLAGS="-DACO_USE_VALGRIND" OUTPUT_SUFFIX="..valgrind.standaloneFPUenv" build_f
188189
# 0 1 0
189-
EXTRA_CFLAGS="-DACO_CONFIG_SHARE_FPU_MXCSR_ENV" OUTPUT_SUFFIX="..no_valgrind.shareFPUenv" build_f
190+
ACO_EXTRA_CFLAGS="-DACO_CONFIG_SHARE_FPU_MXCSR_ENV" OUTPUT_SUFFIX="..no_valgrind.shareFPUenv" build_f
190191
# 0 1 1
191-
EXTRA_CFLAGS="-DACO_CONFIG_SHARE_FPU_MXCSR_ENV -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..valgrind.shareFPUenv" build_f
192+
ACO_EXTRA_CFLAGS="-DACO_CONFIG_SHARE_FPU_MXCSR_ENV -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..valgrind.shareFPUenv" build_f
192193
# 1 0 0
193-
EXTRA_CFLAGS="-m32" OUTPUT_SUFFIX="..m32.no_valgrind.standaloneFPUenv" build_f
194+
ACO_EXTRA_CFLAGS="-m32" OUTPUT_SUFFIX="..m32.no_valgrind.standaloneFPUenv" build_f
194195
# 1 0 1
195-
EXTRA_CFLAGS="-m32 -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..m32.valgrind.standaloneFPUenv" build_f
196+
ACO_EXTRA_CFLAGS="-m32 -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..m32.valgrind.standaloneFPUenv" build_f
196197
# 1 1 0
197-
EXTRA_CFLAGS="-m32 -DACO_CONFIG_SHARE_FPU_MXCSR_ENV" OUTPUT_SUFFIX="..m32.no_valgrind.shareFPUenv" build_f
198+
ACO_EXTRA_CFLAGS="-m32 -DACO_CONFIG_SHARE_FPU_MXCSR_ENV" OUTPUT_SUFFIX="..m32.no_valgrind.shareFPUenv" build_f
198199
# 1 1 1
199-
EXTRA_CFLAGS="-m32 -DACO_CONFIG_SHARE_FPU_MXCSR_ENV -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..m32.valgrind.shareFPUenv" build_f
200+
ACO_EXTRA_CFLAGS="-m32 -DACO_CONFIG_SHARE_FPU_MXCSR_ENV -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..m32.valgrind.shareFPUenv" build_f

test_aco_benchmark.c

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#define _GNU_SOURCE
16+
1517
#include "aco.h"
1618
#include <alloca.h>
1719
#include <stdlib.h>

0 commit comments

Comments
 (0)