Changeset 354:bcf8d9c3317d in roaraudio


Ignore:
Timestamp:
08/02/08 15:42:48 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added integer overflow test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure

    r353 r354  
    44 
    55TF_C=testit.c 
    6 TF_E=testit 
     6TF_E=./testit 
    77CC=cc 
    88 
     
    8686fi 
    8787 
     88echo -n 'checking for save 32 bit integer overflow... ' 
     89 
     90cat > $TF_C << EOF 
     91#include <stdio.h> 
     92#include <stdint.h> 
     93#define TYPE uint32_t 
     94#define MAX  ((TYPE)4294967295U) 
     95 
     96int main (void) { 
     97 TYPE a = MAX; 
     98 
     99 a += 2; 
     100 
     101 if ( a == 1 ) { 
     102  printf("#define ROAR_HAVE_SAFE_OVERFLOW\n"); 
     103  return 0; 
     104 } 
     105 
     106 return 1; 
     107} 
     108EOF 
     109 
     110if $CCTF 2> /dev/null; 
     111then 
     112 $TF_E >&3 
     113 if [ "$?" = '0' ] 
     114 then 
     115  echo yes 
     116 else 
     117  echo no 
     118 fi 
     119else 
     120 echo 'no (can not compile!, no stdint.h?)' 
     121fi 
     122 
    88123cat >&3 << EOF 
    89124 
     
    93128EOF 
    94129 
    95 #rm -f $TF_C $TF_E 
     130rm -f $TF_C $TF_E 
    96131 
    97132#ll 
Note: See TracChangeset for help on using the changeset viewer.