Browse Source

change `asm` to `__asm__` to support cc's `--std=c99` flag (from issue https://github.com/hnes/libaco/issues/16, proposed by Theo Schlossnagle @postwait)

pull/17/head
Sen Han 6 years ago
parent
commit
cd33456b76
  1. 11
      .travis.yml
  2. 2
      aco.c
  3. 6
      aco.h
  4. 29
      make.sh
  5. 2
      test_aco_benchmark.c

11
.travis.yml

@ -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 ""
@ -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:

2
aco.c

@ -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>

6
aco.h

@ -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);

29
make.sh

@ -14,7 +14,7 @@
OUTPUT_DIR="./output"
CFLAGS="-g -O2 -Wall -Werror"
EXTRA_CFLAGS=""
#EXTRA_CFLAGS=""
OUTPUT_SUFFIX=""
makecc="cc"
if [ "$CC" ]
@ -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]+"`
@ -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
@ -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
test_aco_benchmark.c

@ -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>

Loading…
Cancel
Save