Skip to content

Commit

Permalink
change asm to __asm__ to support cc's --std=c99 flag (from issue
Browse files Browse the repository at this point in the history
…#16, proposed by Theo Schlossnagle @postwait)
  • Loading branch information
hnes committed Jul 27, 2018
1 parent ecac993 commit cd33456
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 17 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ script:
- if [ "$TRAVIS_OS_NAME" = "osx" ] ; then brew install gnu-sed --with-default-names; fi
- 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
- date
- export EXTRA_CFLAGS=""
- echo ""
- bash test.sh version_check=1.2.3
- echo ""
Expand All @@ -26,6 +27,16 @@ script:
- mkdir output ; bash make.sh -o no-valgrind ; ls output ; ls output | wc -l ; cd output ; bash ../test.sh ; cd .. ; rm -fr output
- echo ""
- 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
- echo ""
- export EXTRA_CFLAGS="--std=c99"
- echo ""
- 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
- echo ""
- 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
- echo ""
- mkdir output ; bash make.sh -o no-valgrind ; ls output ; ls output | wc -l ; cd output ; bash ../test.sh ; cd .. ; rm -fr output
- echo ""
- 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
- echo "" ; date

matrix:
Expand Down
2 changes: 2 additions & 0 deletions aco.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#define _GNU_SOURCE

#include "aco.h"
#include <stdio.h>
#include <stdint.h>
Expand Down
6 changes: 3 additions & 3 deletions aco.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ extern void aco_runtime_test(void);

extern void aco_thread_init(aco_cofuncp_t last_word_co_fp);

extern void* acosw(aco_t* from_co, aco_t* to_co) asm("acosw"); // asm
extern void* acosw(aco_t* from_co, aco_t* to_co) __asm__("acosw"); // asm

extern void aco_save_fpucw_mxcsr(void* p) asm("aco_save_fpucw_mxcsr"); // asm
extern void aco_save_fpucw_mxcsr(void* p) __asm__("aco_save_fpucw_mxcsr"); // asm

extern void aco_funcp_protector_asm(void) asm("aco_funcp_protector_asm"); // asm
extern void aco_funcp_protector_asm(void) __asm__("aco_funcp_protector_asm"); // asm

extern void aco_funcp_protector(void);

Expand Down
29 changes: 15 additions & 14 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

OUTPUT_DIR="./output"
CFLAGS="-g -O2 -Wall -Werror"
EXTRA_CFLAGS=""
#EXTRA_CFLAGS=""
OUTPUT_SUFFIX=""
makecc="cc"
if [ "$CC" ]
Expand Down Expand Up @@ -71,10 +71,11 @@ function build_f(){
declare build_cmd
declare tmp_ret
declare skip_flag
echo "OUTPUT_DIR: $OUTPUT_DIR"
echo "CFLAGS: $CFLAGS"
echo "EXTRA_CFLAGS: $EXTRA_CFLAGS"
echo "OUTPUT_SUFFIX: $OUTPUT_SUFFIX"
echo "OUTPUT_DIR: $OUTPUT_DIR"
echo "CFLAGS: $CFLAGS"
echo "EXTRA_CFLAGS: $EXTRA_CFLAGS"
echo "ACO_EXTRA_CFLAGS: $ACO_EXTRA_CFLAGS"
echo "OUTPUT_SUFFIX: $OUTPUT_SUFFIX"
echo "$app_list" | grep -Po '.+$' | while read read_in
do
file=`echo $read_in | grep -Po "^[^\s]+"`
Expand All @@ -84,7 +85,7 @@ function build_f(){
continue
fi
#echo "<$file>:<$cflags>:$OUTPUT_DIR:$CFLAGS:$EXTRA_CFLAGS:$OUTPUT_SUFFIX"
build_cmd="$makecc $CFLAGS $EXTRA_CFLAGS acosw.S aco.c $file.c $cflags -o $OUTPUT_DIR/$file$OUTPUT_SUFFIX"
build_cmd="$makecc $CFLAGS $ACO_EXTRA_CFLAGS $EXTRA_CFLAGS acosw.S aco.c $file.c $cflags -o $OUTPUT_DIR/$file$OUTPUT_SUFFIX"
skip_flag=""
if [ "$gl_opt_no_m32" ]
then
Expand Down Expand Up @@ -182,18 +183,18 @@ tra "echo;echo build has been interrupted"
# the matrix of the build config for later testing
# -m32 -DACO_CONFIG_SHARE_FPU_MXCSR_ENV -DACO_USE_VALGRIND
# 0 0 0
EXTRA_CFLAGS="" OUTPUT_SUFFIX="..no_valgrind.standaloneFPUenv" build_f
ACO_EXTRA_CFLAGS="" OUTPUT_SUFFIX="..no_valgrind.standaloneFPUenv" build_f
# 0 0 1
EXTRA_CFLAGS="-DACO_USE_VALGRIND" OUTPUT_SUFFIX="..valgrind.standaloneFPUenv" build_f
ACO_EXTRA_CFLAGS="-DACO_USE_VALGRIND" OUTPUT_SUFFIX="..valgrind.standaloneFPUenv" build_f
# 0 1 0
EXTRA_CFLAGS="-DACO_CONFIG_SHARE_FPU_MXCSR_ENV" OUTPUT_SUFFIX="..no_valgrind.shareFPUenv" build_f
ACO_EXTRA_CFLAGS="-DACO_CONFIG_SHARE_FPU_MXCSR_ENV" OUTPUT_SUFFIX="..no_valgrind.shareFPUenv" build_f
# 0 1 1
EXTRA_CFLAGS="-DACO_CONFIG_SHARE_FPU_MXCSR_ENV -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..valgrind.shareFPUenv" build_f
ACO_EXTRA_CFLAGS="-DACO_CONFIG_SHARE_FPU_MXCSR_ENV -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..valgrind.shareFPUenv" build_f
# 1 0 0
EXTRA_CFLAGS="-m32" OUTPUT_SUFFIX="..m32.no_valgrind.standaloneFPUenv" build_f
ACO_EXTRA_CFLAGS="-m32" OUTPUT_SUFFIX="..m32.no_valgrind.standaloneFPUenv" build_f
# 1 0 1
EXTRA_CFLAGS="-m32 -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..m32.valgrind.standaloneFPUenv" build_f
ACO_EXTRA_CFLAGS="-m32 -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..m32.valgrind.standaloneFPUenv" build_f
# 1 1 0
EXTRA_CFLAGS="-m32 -DACO_CONFIG_SHARE_FPU_MXCSR_ENV" OUTPUT_SUFFIX="..m32.no_valgrind.shareFPUenv" build_f
ACO_EXTRA_CFLAGS="-m32 -DACO_CONFIG_SHARE_FPU_MXCSR_ENV" OUTPUT_SUFFIX="..m32.no_valgrind.shareFPUenv" build_f
# 1 1 1
EXTRA_CFLAGS="-m32 -DACO_CONFIG_SHARE_FPU_MXCSR_ENV -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..m32.valgrind.shareFPUenv" build_f
ACO_EXTRA_CFLAGS="-m32 -DACO_CONFIG_SHARE_FPU_MXCSR_ENV -DACO_USE_VALGRIND" OUTPUT_SUFFIX="..m32.valgrind.shareFPUenv" build_f
2 changes: 2 additions & 0 deletions test_aco_benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#define _GNU_SOURCE

#include "aco.h"
#include <alloca.h>
#include <stdlib.h>
Expand Down

0 comments on commit cd33456

Please sign in to comment.