PennMUSH Community

Changeset 874

Show
Ignore:
Timestamp:
05/23/07 19:40:20 (1 year ago)
Author:
shawnw
Message:

Some linting. New BOOL type for boolean values attempts to use the C99 _Bool type if supported by the compiler.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/branches/devel/config.h.in

    r873 r874  
    6262#undef HAVE_SYS_RESOURCE_H 
    6363 
     64#undef HAVE_STDBOOL_H 
     65 
    6466/* Libraries */ 
    6567 
     
    8991 
    9092#undef pid_t 
     93 
     94#ifdef HAVE__BOOL 
     95typedef _Bool BOOL; 
     96#else 
     97typedef int BOOL; 
     98#endif 
    9199 
    92100typedef void* Malloc_t; 
  • 1.8.3/branches/devel/configure

    r865 r874  
    27652765ac_compiler_gnu=$ac_cv_c_compiler_gnu 
    27662766 
     2767   { echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5 
     2768echo $ECHO_N "checking for $CC option to accept ISO C99... $ECHO_C" >&6; } 
     2769if test "${ac_cv_prog_cc_c99+set}" = set; then 
     2770  echo $ECHO_N "(cached) $ECHO_C" >&6 
     2771else 
     2772  ac_cv_prog_cc_c99=no 
     2773ac_save_CC=$CC 
     2774cat >conftest.$ac_ext <<_ACEOF 
     2775/* confdefs.h.  */ 
     2776_ACEOF 
     2777cat confdefs.h >>conftest.$ac_ext 
     2778cat >>conftest.$ac_ext <<_ACEOF 
     2779/* end confdefs.h.  */ 
     2780#include <stdarg.h> 
     2781#include <stdbool.h> 
     2782#include <stdlib.h> 
     2783#include <wchar.h> 
     2784#include <stdio.h> 
     2785 
     2786struct incomplete_array 
     2787{ 
     2788  int datasize; 
     2789  double data[]; 
     2790}; 
     2791 
     2792struct named_init { 
     2793  int number; 
     2794  const wchar_t *name; 
     2795  double average; 
     2796}; 
     2797 
     2798typedef const char *ccp; 
     2799 
     2800static inline int 
     2801test_restrict(ccp restrict text) 
     2802{ 
     2803  // See if C++-style comments work. 
     2804  // Iterate through items via the restricted pointer. 
     2805  // Also check for declarations in for loops. 
     2806  for (unsigned int i = 0; *(text+i) != '\0'; ++i) 
     2807    continue; 
     2808  return 0; 
     2809} 
     2810 
     2811// Check varargs and va_copy work. 
     2812static void 
     2813test_varargs(const char *format, ...) 
     2814{ 
     2815  va_list args; 
     2816  va_start(args, format); 
     2817  va_list args_copy; 
     2818  va_copy(args_copy, args); 
     2819 
     2820  const char *str; 
     2821  int number; 
     2822  float fnumber; 
     2823 
     2824  while (*format) 
     2825    { 
     2826      switch (*format++) 
     2827    { 
     2828    case 's': // string 
     2829      str = va_arg(args_copy, const char *); 
     2830      break; 
     2831    case 'd': // int 
     2832      number = va_arg(args_copy, int); 
     2833      break; 
     2834    case 'f': // float 
     2835      fnumber = (float) va_arg(args_copy, double); 
     2836      break; 
     2837    default: 
     2838      break; 
     2839    } 
     2840    } 
     2841  va_end(args_copy); 
     2842  va_end(args); 
     2843} 
     2844 
     2845int 
     2846main () 
     2847{ 
     2848 
     2849  // Check bool and long long datatypes. 
     2850  _Bool success = false; 
     2851  long long int bignum = -1234567890LL; 
     2852  unsigned long long int ubignum = 1234567890uLL; 
     2853 
     2854  // Check restrict. 
     2855  if (test_restrict("String literal") != 0) 
     2856    success = true; 
     2857  char *restrict newvar = "Another string"; 
     2858 
     2859  // Check varargs. 
     2860  test_varargs("s, d' f .", "string", 65, 34.234); 
     2861 
     2862  // Check incomplete arrays work. 
     2863  struct incomplete_array *ia = 
     2864    malloc(sizeof(struct incomplete_array) + (sizeof(double) * 10)); 
     2865  ia->datasize = 10; 
     2866  for (int i = 0; i < ia->datasize; ++i) 
     2867    ia->data[i] = (double) i * 1.234; 
     2868 
     2869  // Check named initialisers. 
     2870  struct named_init ni = { 
     2871    .number = 34, 
     2872    .name = L"Test wide string", 
     2873    .average = 543.34343, 
     2874  }; 
     2875 
     2876  ni.number = 58; 
     2877 
     2878  int dynamic_array[ni.number]; 
     2879  dynamic_array[43] = 543; 
     2880 
     2881  // work around unused variable warnings 
     2882  return  bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'; 
     2883 
     2884  ; 
     2885  return 0; 
     2886} 
     2887_ACEOF 
     2888for ac_arg in '' -std=gnu99 -c99 -qlanglvl=extc99 
     2889do 
     2890  CC="$ac_save_CC $ac_arg" 
     2891  rm -f conftest.$ac_objext 
     2892if { (ac_try="$ac_compile" 
     2893case "(($ac_try" in 
     2894  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     2895  *) ac_try_echo=$ac_try;; 
     2896esac 
     2897eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     2898  (eval "$ac_compile") 2>conftest.er1 
     2899  ac_status=$? 
     2900  grep -v '^ *+' conftest.er1 >conftest.err 
     2901  rm -f conftest.er1 
     2902  cat conftest.err >&5 
     2903  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     2904  (exit $ac_status); } && 
     2905     { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' 
     2906  { (case "(($ac_try" in 
     2907  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     2908  *) ac_try_echo=$ac_try;; 
     2909esac 
     2910eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     2911  (eval "$ac_try") 2>&5 
     2912  ac_status=$? 
     2913  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     2914  (exit $ac_status); }; } && 
     2915     { ac_try='test -s conftest.$ac_objext' 
     2916  { (case "(($ac_try" in 
     2917  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     2918  *) ac_try_echo=$ac_try;; 
     2919esac 
     2920eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     2921  (eval "$ac_try") 2>&5 
     2922  ac_status=$? 
     2923  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     2924  (exit $ac_status); }; }; then 
     2925  ac_cv_prog_cc_c99=$ac_arg 
     2926else 
     2927  echo "$as_me: failed program was:" >&5 
     2928sed 's/^/| /' conftest.$ac_ext >&5 
     2929 
     2930 
     2931fi 
     2932 
     2933rm -f core conftest.err conftest.$ac_objext 
     2934  test "x$ac_cv_prog_cc_c99" != "xno" && break 
     2935done 
     2936rm -f conftest.$ac_ext 
     2937CC=$ac_save_CC 
     2938 
     2939fi 
     2940# AC_CACHE_VAL 
     2941case "x$ac_cv_prog_cc_c99" in 
     2942  x) 
     2943    { echo "$as_me:$LINENO: result: none needed" >&5 
     2944echo "${ECHO_T}none needed" >&6; } ;; 
     2945  xno) 
     2946    { echo "$as_me:$LINENO: result: unsupported" >&5 
     2947echo "${ECHO_T}unsupported" >&6; } ;; 
     2948  *) 
     2949    CC="$CC $ac_cv_prog_cc_c99" 
     2950    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5 
     2951echo "${ECHO_T}$ac_cv_prog_cc_c99" >&6; } ;; 
     2952esac 
     2953 
     2954 
     2955 
    27672956# Extract the first word of "chmod", so it can be a program name with args. 
    27682957set dummy chmod; ac_word=$2 
     
    40984287fi 
    40994288 
     4289# On IRIX 5.3, sys/types and inttypes.h are conflicting. 
     4290 
     4291 
     4292 
     4293 
     4294 
     4295 
     4296 
     4297 
     4298 
     4299for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ 
     4300          inttypes.h stdint.h unistd.h 
     4301do 
     4302as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` 
     4303{ echo "$as_me:$LINENO: checking for $ac_header" >&5 
     4304echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } 
     4305if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then 
     4306  echo $ECHO_N "(cached) $ECHO_C" >&6 
     4307else 
     4308  cat >conftest.$ac_ext <<_ACEOF 
     4309/* confdefs.h.  */ 
     4310_ACEOF 
     4311cat confdefs.h >>conftest.$ac_ext 
     4312cat >>conftest.$ac_ext <<_ACEOF 
     4313/* end confdefs.h.  */ 
     4314$ac_includes_default 
     4315 
     4316#include <$ac_header> 
     4317_ACEOF 
     4318rm -f conftest.$ac_objext 
     4319if { (ac_try="$ac_compile" 
     4320case "(($ac_try" in 
     4321  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     4322  *) ac_try_echo=$ac_try;; 
     4323esac 
     4324eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     4325  (eval "$ac_compile") 2>conftest.er1 
     4326  ac_status=$? 
     4327  grep -v '^ *+' conftest.er1 >conftest.err 
     4328  rm -f conftest.er1 
     4329  cat conftest.err >&5 
     4330  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     4331  (exit $ac_status); } && 
     4332     { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' 
     4333  { (case "(($ac_try" in 
     4334  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     4335  *) ac_try_echo=$ac_try;; 
     4336esac 
     4337eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     4338  (eval "$ac_try") 2>&5 
     4339  ac_status=$? 
     4340  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     4341  (exit $ac_status); }; } && 
     4342     { ac_try='test -s conftest.$ac_objext' 
     4343  { (case "(($ac_try" in 
     4344  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     4345  *) ac_try_echo=$ac_try;; 
     4346esac 
     4347eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     4348  (eval "$ac_try") 2>&5 
     4349  ac_status=$? 
     4350  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     4351  (exit $ac_status); }; }; then 
     4352  eval "$as_ac_Header=yes" 
     4353else 
     4354  echo "$as_me: failed program was:" >&5 
     4355sed 's/^/| /' conftest.$ac_ext >&5 
     4356 
     4357    eval "$as_ac_Header=no" 
     4358fi 
     4359 
     4360rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     4361fi 
     4362ac_res=`eval echo '${'$as_ac_Header'}'` 
     4363           { echo "$as_me:$LINENO: result: $ac_res" >&5 
     4364echo "${ECHO_T}$ac_res" >&6; } 
     4365if test `eval echo '${'$as_ac_Header'}'` = yes; then 
     4366  cat >>confdefs.h <<_ACEOF 
     4367#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 
     4368_ACEOF 
     4369 
     4370fi 
     4371 
     4372done 
     4373 
     4374 
     4375{ echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 
     4376echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6; } 
     4377if test "${ac_cv_header_stdbool_h+set}" = set; then 
     4378  echo $ECHO_N "(cached) $ECHO_C" >&6 
     4379else 
     4380  cat >conftest.$ac_ext <<_ACEOF 
     4381/* confdefs.h.  */ 
     4382_ACEOF 
     4383cat confdefs.h >>conftest.$ac_ext 
     4384cat >>conftest.$ac_ext <<_ACEOF 
     4385/* end confdefs.h.  */ 
     4386 
     4387#include <stdbool.h> 
     4388#ifndef bool 
     4389 "error: bool is not defined" 
     4390#endif 
     4391#ifndef false 
     4392 "error: false is not defined" 
     4393#endif 
     4394#if false 
     4395 "error: false is not 0" 
     4396#endif 
     4397#ifndef true 
     4398 "error: true is not defined" 
     4399#endif 
     4400#if true != 1 
     4401 "error: true is not 1" 
     4402#endif 
     4403#ifndef __bool_true_false_are_defined 
     4404 "error: __bool_true_false_are_defined is not defined" 
     4405#endif 
     4406 
     4407    struct s { _Bool s: 1; _Bool t; } s; 
     4408 
     4409    char a[true == 1 ? 1 : -1]; 
     4410    char b[false == 0 ? 1 : -1]; 
     4411    char c[__bool_true_false_are_defined == 1 ? 1 : -1]; 
     4412    char d[(bool) 0.5 == true ? 1 : -1]; 
     4413    bool e = &s; 
     4414    char f[(_Bool) 0.0 == false ? 1 : -1]; 
     4415    char g[true]; 
     4416    char h[sizeof (_Bool)]; 
     4417    char i[sizeof s.t]; 
     4418    enum { j = false, k = true, l = false * true, m = true * 256 }; 
     4419    _Bool n[m]; 
     4420    char o[sizeof n == m * sizeof n[0] ? 1 : -1]; 
     4421    char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; 
     4422#   if defined __xlc__ || defined __GNUC__ 
     4423     /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 
     4424        reported by James Lemley on 2005-10-05; see 
     4425        http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html 
     4426        This test is not quite right, since xlc is allowed to 
     4427        reject this program, as the initializer for xlcbug is 
     4428        not one of the forms that C requires support for. 
     4429        However, doing the test right would require a runtime 
     4430        test, and that would make cross-compilation harder. 
     4431        Let us hope that IBM fixes the xlc bug, and also adds 
     4432        support for this kind of constant expression.  In the 
     4433        meantime, this test will reject xlc, which is OK, since 
     4434        our stdbool.h substitute should suffice.  We also test 
     4435        this with GCC, where it should work, to detect more 
     4436        quickly whether someone messes up the test in the 
     4437        future.  */ 
     4438     char digs[] = "0123456789"; 
     4439     int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); 
     4440#   endif 
     4441    /* Catch a bug in an HP-UX C compiler.  See 
     4442       http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html 
     4443       http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html 
     4444     */ 
     4445    _Bool q = true; 
     4446    _Bool *pq = &q; 
     4447 
     4448int 
     4449main () 
     4450{ 
     4451 
     4452    *pq |= q; 
     4453    *pq |= ! q; 
     4454    /* Refer to every declared value, to avoid compiler optimizations.  */ 
     4455    return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l 
     4456        + !m + !n + !o + !p + !q + !pq); 
     4457 
     4458  ; 
     4459  return 0; 
     4460} 
     4461_ACEOF 
     4462rm -f conftest.$ac_objext 
     4463if { (ac_try="$ac_compile" 
     4464case "(($ac_try" in 
     4465  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     4466  *) ac_try_echo=$ac_try;; 
     4467esac 
     4468eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     4469  (eval "$ac_compile") 2>conftest.er1 
     4470  ac_status=$? 
     4471  grep -v '^ *+' conftest.er1 >conftest.err 
     4472  rm -f conftest.er1 
     4473  cat conftest.err >&5 
     4474  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     4475  (exit $ac_status); } && 
     4476     { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' 
     4477  { (case "(($ac_try" in 
     4478  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     4479  *) ac_try_echo=$ac_try;; 
     4480esac 
     4481eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     4482  (eval "$ac_try") 2>&5 
     4483  ac_status=$? 
     4484  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     4485  (exit $ac_status); }; } && 
     4486     { ac_try='test -s conftest.$ac_objext' 
     4487  { (case "(($ac_try" in 
     4488  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     4489  *) ac_try_echo=$ac_try;; 
     4490esac 
     4491eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     4492  (eval "$ac_try") 2>&5 
     4493  ac_status=$? 
     4494  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     4495  (exit $ac_status); }; }; then 
     4496  ac_cv_header_stdbool_h=yes 
     4497else 
     4498  echo "$as_me: failed program was:" >&5 
     4499sed 's/^/| /' conftest.$ac_ext >&5 
     4500 
     4501    ac_cv_header_stdbool_h=no 
     4502fi 
     4503 
     4504rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     4505fi 
     4506{ echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 
     4507echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6; } 
     4508{ echo "$as_me:$LINENO: checking for _Bool" >&5 
     4509echo $ECHO_N "checking for _Bool... $ECHO_C" >&6; } 
     4510if test "${ac_cv_type__Bool+set}" = set; then 
     4511  echo $ECHO_N "(cached) $ECHO_C" >&6 
     4512else 
     4513  cat >conftest.$ac_ext <<_ACEOF 
     4514/* confdefs.h.  */ 
     4515_ACEOF 
     4516cat confdefs.h >>conftest.$ac_ext 
     4517cat >>conftest.$ac_ext <<_ACEOF 
     4518/* end confdefs.h.  */ 
     4519$ac_includes_default 
     4520typedef _Bool ac__type_new_; 
     4521int 
     4522main () 
     4523{ 
     4524if ((ac__type_new_ *) 0) 
     4525  return 0; 
     4526if (sizeof (ac__type_new_)) 
     4527  return 0; 
     4528  ; 
     4529  return 0; 
     4530} 
     4531_ACEOF 
     4532rm -f conftest.$ac_objext 
     4533if { (ac_try="$ac_compile" 
     4534case "(($ac_try" in 
     4535  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     4536  *) ac_try_echo=$ac_try;; 
     4537esac 
     4538eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     4539  (eval "$ac_compile") 2>conftest.er1 
     4540  ac_status=$? 
     4541  grep -v '^ *+' conftest.er1 >conftest.err 
     4542  rm -f conftest.er1 
     4543  cat conftest.err >&5 
     4544  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     4545  (exit $ac_status); } && 
     4546     { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' 
     4547  { (case "(($ac_try" in 
     4548  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     4549  *) ac_try_echo=$ac_try;; 
     4550esac 
     4551eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     4552  (eval "$ac_try") 2>&5 
     4553  ac_status=$? 
     4554  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     4555  (exit $ac_status); }; } && 
     4556     { ac_try='test -s conftest.$ac_objext' 
     4557  { (case "(($ac_try" in 
     4558  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     4559  *) ac_try_echo=$ac_try;; 
     4560esac 
     4561eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     4562  (eval "$ac_try") 2>&5 
     4563  ac_status=$? 
     4564  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     4565  (exit $ac_status); }; }; then 
     4566  ac_cv_type__Bool=yes 
     4567else 
     4568  echo "$as_me: failed program was:" >&5 
     4569sed 's/^/| /' conftest.$ac_ext >&5 
     4570 
     4571    ac_cv_type__Bool=no 
     4572fi 
     4573 
     4574rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     4575fi 
     4576{ echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 
     4577echo "${ECHO_T}$ac_cv_type__Bool" >&6; } 
     4578if test $ac_cv_type__Bool = yes; then 
     4579 
     4580cat >>confdefs.h <<_ACEOF 
     4581#define HAVE__BOOL 1 
     4582_ACEOF 
     4583 
     4584 
     4585fi 
     4586 
     4587if test $ac_cv_header_stdbool_h = yes; then 
     4588 
     4589cat >>confdefs.h <<\_ACEOF 
     4590#define HAVE_STDBOOL_H 1 
     4591_ACEOF 
     4592 
     4593fi 
     4594 
    41004595{ echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 
    41014596echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6; } 
     
    42594754 
    42604755fi 
    4261  
    4262 # On IRIX 5.3, sys/types and inttypes.h are conflicting. 
    4263  
    4264  
    4265  
    4266  
    4267  
    4268  
    4269  
    4270  
    4271  
    4272 for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ 
    4273           inttypes.h stdint.h unistd.h 
    4274 do 
    4275 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` 
    4276 { echo "$as_me:$LINENO: checking for $ac_header" >&5 
    4277 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } 
    4278 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then 
    4279   echo $ECHO_N "(cached) $ECHO_C" >&6 
    4280 else 
    4281   cat >conftest.$ac_ext <<_ACEOF 
    4282 /* confdefs.h.  */ 
    4283 _ACEOF 
    4284 cat confdefs.h >>conftest.$ac_ext 
    4285 cat >>conftest.$ac_ext <<_ACEOF 
    4286 /* end confdefs.h.  */ 
    4287 $ac_includes_default 
    4288  
    4289 #include <$ac_header> 
    4290 _ACEOF 
    4291 rm -f conftest.$ac_objext 
    4292 if { (ac_try="$ac_compile" 
    4293 case "(($ac_try" in 
    4294   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
    4295   *) ac_try_echo=$ac_try;; 
    4296 esac 
    4297 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
    4298   (eval "$ac_compile") 2>conftest.er1 
    4299   ac_status=$? 
    4300   grep -v '^ *+' conftest.er1 >conftest.err 
    4301   rm -f conftest.er1 
    4302   cat conftest.err >&5 
    4303   echo "$as_me:$LINENO: \$? = $ac_status" >&5 
    4304   (exit $ac_status); } && 
    4305      { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' 
    4306   { (case "(($ac_try" in 
    4307   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
    4308   *) ac_try_echo=$ac_try;; 
    4309 esac 
    4310 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
    4311   (eval "$ac_try") 2>&5 
    4312   ac_status=$? 
    4313   echo "$as_me:$LINENO: \$? = $ac_status" >&5 
    4314   (exit $ac_status); }; } && 
    4315      { ac_try='test -s conftest.$ac_objext' 
    4316   { (case "(($ac_try" in 
    4317   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
    4318   *) ac_try_echo=$ac_try;; 
    4319 esac 
    4320 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
    4321   (eval "$ac_try") 2>&5 
    4322   ac_status=$? 
    4323   echo "$as_me:$LINENO: \$? = $ac_status" >&5 
    4324   (exit $ac_status); }; }; then 
    4325   eval "$as_ac_Header=yes" 
    4326 else 
    4327   echo "$as_me: failed program was:" >&5 
    4328 sed 's/^/| /' conftest.$ac_ext >&5 
    4329  
    4330     eval "$as_ac_Header=no" 
    4331 fi 
    4332  
    4333 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
    4334 fi 
    4335 ac_res=`eval echo '${'$as_ac_Header'}'` 
    4336            { echo "$as_me:$LINENO: result: $ac_res" >&5 
    4337 echo "${ECHO_T}$ac_res" >&6; } 
    4338 if test `eval echo '${'$as_ac_Header'}'` = yes; then 
    4339   cat >>confdefs.h <<_ACEOF 
    4340 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 
    4341 _ACEOF 
    4342  
    4343 fi 
    4344  
    4345 done 
    4346  
    43474756 
    43484757if test "${ac_cv_header_sys_time_h+set}" = set; then 
  • 1.8.3/branches/devel/configure.in

    r865 r874  
    1414AC_PATH_PROG(CAT, cat) 
    1515AC_PROG_CC 
     16AC_PROG_CC_C99 
    1617AC_PATH_PROG(CHMOD, chmod) 
    1718AC_PATH_PROG(CP, cp) 
     
    5758# <stdint.h> is checked by this. 
    5859AC_HEADER_STDC 
     60AC_HEADER_STDBOOL 
    5961AC_HEADER_SYS_WAIT 
    6062AC_HEADER_TIME 
  • 1.8.3/branches/devel/hdrs/atr_tab.h

    r681 r874  
    6868  {"FOLLOW", AF_NOPROG | AF_PREFIXMATCH, NULL_CHUNK_REFERENCE, 0, NULL}, 
    6969 
    70   {"FOLLOWING", AF_NOPROG | AF_PRIVATE | AF_WIZARD | AF_NOCOPY
    71    NULL_CHUNK_REFERENCE, 0 | AF_PREFIXMATCH, NULL}, 
    72   {"FOLLOWERS", AF_NOPROG | AF_PRIVATE | AF_WIZARD | AF_NOCOPY
    73    NULL_CHUNK_REFERENCE, 0 | AF_PREFIXMATCH, NULL}, 
     70  {"FOLLOWING", AF_NOPROG | AF_PRIVATE | AF_WIZARD | AF_NOCOPY | AF_PREFIXMATCH
     71   NULL_CHUNK_REFERENCE, 0, NULL}, 
     72  {"FOLLOWERS", AF_NOPROG | AF_PRIVATE | AF_WIZARD | AF_NOCOPY | AF_PREFIXMATCH
     73   NULL_CHUNK_REFERENCE, 0, NULL}, 
    7474  {"FORWARDLIST", AF_NOPROG | AF_PRIVATE | AF_PREFIXMATCH, NULL_CHUNK_REFERENCE, 
    7575   0, NULL}, 
  • 1.8.3/branches/devel/hdrs/attrib.h

    r817 r874  
    8181extern void do_atrlock(dbref player, char const *arg1, char const *arg2); 
    8282extern void do_atrchown(dbref player, char const *arg1, char const *arg2); 
    83 extern int string_to_atrflag(dbref player, const char *p); 
    84 extern int string_to_atrflagsets(dbref player, const char *p, int *setbits, 
    85                  int *clrbits); 
    86 extern const char *atrflag_to_string(int mask); 
     83int string_to_atrflag(dbref player, const char *p, privbits *bits); 
     84int string_to_atrflagsets(dbref player, const char *p, privbits *setbits, 
     85                 privbits *clrbits); 
     86extern const char *atrflag_to_string(privbits mask); 
    8787extern void init_atr_name_tree(void); 
    8888 
     
    9797 
    9898/* possible attribute flags */ 
    99 #define AF_ODARK        0x1   /**< OBSOLETE! Leave here but don't use */ 
    100 #define AF_INTERNAL     0x2   /**< no one can see it or set it */ 
    101 #define AF_WIZARD       0x4   /**< Wizard only can change it */ 
    102 #define AF_NUKED        0x8   /**< OBSOLETE! Leave here but don't use */ 
    103 #define AF_LOCKED       0x10  /**< Only creator of attrib can change it. */ 
    104 #define AF_NOPROG       0x20  /**< won't be searched for $ commands. */ 
    105 #define AF_MDARK        0x40  /**< Only wizards can see it */ 
    106 #define AF_PRIVATE      0x80  /**< Children don't inherit it */ 
    107 #define AF_NOCOPY       0x100 /**< atr_cpy (for @clone) doesn't copy it */ 
    108 #define AF_VISUAL       0x200 /**< Everyone can see this attribute */ 
    109 #define AF_REGEXP       0x400 /**< Match $/^ patterns using regexps */ 
    110 #define AF_CASE         0x800 /**< Match $/^ patterns case-sensitive */ 
    111 #define AF_SAFE         0x1000    /**< This attribute may not be modified */ 
    112 #define AF_ROOT         0x2000    /**< Root of an attribute tree */ 
    113 #define AF_UNDEF1       0x4000    /**< Undefined; reserved for a future flag */ 
    114 #define AF_UNDEF2       0x8000    /**< Undefined; reserved for a future flag */ 
    115 #define AF_STATIC       0x10000   /**< OBSOLETE! Leave here but don't use */ 
    116 #define AF_COMMAND      0x20000   /**< INTERNAL: value starts with $ */ 
    117 #define AF_LISTEN       0x40000   /**< INTERNAL: value starts with ^ */ 
    118 #define AF_NODUMP       0x80000   /**< INTERNAL: attribute is not saved */ 
    119 #define AF_LISTED       0x100000  /**< INTERNAL: Used in @list attribs */ 
    120 #define AF_PREFIXMATCH  0x200000  /**< Subject to prefix-matching */ 
    121 #define AF_VEILED       0x400000  /**< On ex, show presence, not value */ 
    122 #define AF_DEBUG        0x800000  /**< Show debug when evaluated */ 
    123 #define AF_NEARBY       0x1000000 /**< Override AF_VISUAL if remote */ 
    124 #define AF_PUBLIC       0x2000000 /**< Override SAFER_UFUN */ 
    125 #define AF_ANON         0x4000000 /**< INTERNAL: Attribute doesn't really 
     99#define AF_ODARK        0x1U  /**< OBSOLETE! Leave here but don't use */ 
     100#define AF_INTERNAL     0x2U  /**< no one can see it or set it */ 
     101#define AF_WIZARD       0x4U  /**< Wizard only can change it */ 
     102#define AF_NUKED        0x8U  /**< OBSOLETE! Leave here but don't use */ 
     103#define AF_LOCKED       0x10U /**< Only creator of attrib can change it. */ 
     104#define AF_NOPROG       0x20U /**< won't be searched for $ commands. */ 
     105#define AF_MDARK        0x40U /**< Only wizards can see it */ 
     106#define AF_PRIVATE      0x80U /**< Children don't inherit it */ 
     107#define AF_NOCOPY       0x100U    /**< atr_cpy (for @clone) doesn't copy it */ 
     108#define AF_VISUAL       0x200U    /**< Everyone can see this attribute */ 
     109#define AF_REGEXP       0x400U    /**< Match $/^ patterns using regexps */ 
     110#define AF_CASE         0x800U    /**< Match $/^ patterns case-sensitive */ 
     111#define AF_SAFE         0x1000U   /**< This attribute may not be modified */ 
     112#define AF_ROOT         0x2000U   /**< Root of an attribute tree */ 
     113#define AF_UNDEF1       0x4000U   /**< Undefined; reserved for a future flag */ 
     114#define AF_UNDEF2       0x8000U   /**< Undefined; reserved for a future flag */ 
     115#define AF_STATIC       0x10000U  /**< OBSOLETE! Leave here but don't use */ 
     116#define AF_COMMAND      0x20000U  /**< INTERNAL: value starts with $ */ 
     117#define AF_LISTEN       0x40000U  /**< INTERNAL: value starts with ^ */ 
     118#define AF_NODUMP       0x80000U  /**< INTERNAL: attribute is not saved */ 
     119#define AF_LISTED       0x100000U /**< INTERNAL: Used in @list attribs */ 
     120#define AF_PREFIXMATCH  0x200000U /**< Subject to prefix-matching */ 
     121#define AF_VEILED       0x400000U /**< On ex, show presence, not value */ 
     122#define AF_DEBUG        0x800000U /**< Show debug when evaluated */ 
     123#define AF_NEARBY       0x1000000U    /**< Override AF_VISUAL if remote */ 
     124#define AF_PUBLIC       0x2000000U    /**< Override SAFER_UFUN */ 
     125#define AF_ANON         0x4000000U    /**< INTERNAL: Attribute doesn't really 
    126126                       exist in the database */ 
    127 #define AF_NONAME       0x8000000 /**< No name in did_it */ 
    128 #define AF_NOSPACE      0x10000000    /**< No space in did_it */ 
    129 #define AF_MHEAR        0x20000000    /**< ^-listens can be triggered by %! */ 
    130 #define AF_AHEAR        0x40000000    /**< ^-listens can be triggered by anyone */ 
    131 #define AF_UNDEF3       0x80000000    /**< Undefined; reserved for a future flag */ 
     127#define AF_NONAME       0x8000000U    /**< No name in did_it */ 
     128#define AF_NOSPACE      0x10000000U   /**< No space in did_it */ 
     129#define AF_MHEAR        0x20000000U   /**< ^-listens can be triggered by %! */ 
     130#define AF_AHEAR        0x40000000U   /**< ^-listens can be triggered by anyone */ 
     131#define AF_UNDEF3       0x80000000U   /**< Undefined; reserved for a future flag */ 
    132132 
    133 #define AF_MAXVALUE          0x100000000     /**< Largest attribute flag value. */ 
     133#define AF_MAXVALUE          0x100000000U     /**< Largest attribute flag value. */ 
    134134 
    135135    extern ATTR attr[]; 
  • 1.8.3/branches/devel/hdrs/externs.h

    r803 r874  
    402402extern char *split_token(char **sp, char sep); 
    403403extern char *chopstr(const char *str, size_t lim); 
    404 extern int string_prefix(const char *RESTRICT string, 
    405              const char *RESTRICT prefix); 
     404extern int string_prefix(const char * restrict string, 
     405             const char * restrict prefix); 
    406406extern const char *string_match(const char *src, const char *sub); 
    407407extern char *strupper(const char *s); 
     
    562562/* From wild.c */ 
    563563    extern int local_wild_match_case(const char *RESTRICT s, 
    564                      const char *RESTRICT d, int cs); 
     564                     const char *RESTRICT d, BOOL cs); 
    565565    extern int wildcard(const char *s); 
    566566    extern int quick_wild_new(const char *RESTRICT tstr, 
    567                   const char *RESTRICT dstr, int cs); 
     567                  const char *RESTRICT dstr, BOOL cs); 
    568568    extern int regexp_match_case(const char *RESTRICT s, const char *RESTRICT d, 
    569                  int cs); 
     569                 BOOL cs); 
    570570    extern int quick_regexp_match(const char *RESTRICT s, 
    571                   const char *RESTRICT d, int cs); 
     571                  const char *RESTRICT d, BOOL cs); 
    572572    extern int wild_match_case(const char *RESTRICT s, const char *RESTRICT d, 
    573                    int cs); 
     573                   BOOL cs); 
    574574    extern int wild_match_case_r(const char *RESTRICT s, 
    575                  const char *RESTRICT d, int cs, 
     575                 const char *RESTRICT d, BOOL cs, 
    576576                 char **ary, int max); 
    577577    extern int quick_wild(const char *RESTRICT tsr, const char *RESTRICT dstr); 
  • 1.8.3/branches/devel/hdrs/lock.h

    r527 r874  
    2626  boolexp key;      /**< Lock value ("key") */ 
    2727  dbref creator;        /**< Dbref of lock creator */ 
    28   int flags;          /**< Lock flags */ 
     28  privbits flags;         /**< Lock flags */ 
    2929  struct lock_list *next;   /**< Pointer to next lock in object's list */ 
    3030}; 
     
    4141}; 
    4242 
    43 #define LF_VISUAL  0x1      /* Anyone can see this lock with lock()/elock() */ 
    44 #define LF_PRIVATE 0x2      /* This lock doesn't get inherited */ 
    45 #define LF_WIZARD  0x4      /* Only wizards can set/unset this lock */ 
    46 #define LF_LOCKED  0x8      /* Only the lock's owner can set/unset it */ 
    47 #define LF_NOCLONE 0x10     /* This lock isn't copied in @clone */ 
    48 #define LF_OX      0x20     /* This lock's success messages includes OX*. */ 
    49 #define LF_NOSUCCACTION 0x40    /* This lock doesn't have an @a-action for success. */ 
    50 #define LF_NOFAILACTION 0x80    /* This lock doesn't have an @a-action for failure */ 
    51 #define LF_OWNER        0x100   /* Lock can only be set/unset by object's owner */ 
     43#define LF_VISUAL  0x1U     /**< Anyone can see this lock with lock()/elock() */ 
     44#define LF_PRIVATE 0x2U     /**< This lock doesn't get inherited */ 
     45#define LF_WIZARD  0x4U     /**< Only wizards can set/unset this lock */ 
     46#define LF_LOCKED  0x8U     /**< Only the lock's owner can set/unset it */ 
     47#define LF_NOCLONE 0x10U        /**< This lock isn't copied in @clone */ 
     48#define LF_OX      0x20U        /**< This lock's success messages includes OX*. */ 
     49#define LF_NOSUCCACTION 0x40U   /**< This lock doesn't have an @a-action for success. */ 
     50#define LF_NOFAILACTION 0x80U   /**< This lock doesn't have an @a-action for failure */ 
     51#define LF_OWNER        0x100U  /**< Lock can only be set/unset by object's owner */ 
     52#define LF_DEFAULT        0x200U  /**< Use default flags when setting lock */ 
    5253 
    5354/* lock.c */ 
     
    5657lock_type match_lock(lock_type type); 
    5758const lock_list *get_lockproto(lock_type type); 
    58 int add_lock(dbref player, dbref thing, lock_type type, boolexp key, int flags); 
     59int add_lock(dbref player, dbref thing, lock_type type, boolexp key,  
     60         privbits flags); 
    5961int add_lock_raw(dbref player, dbref thing, lock_type type, 
    60          boolexp key, int flags); 
     62         boolexp key, privbits flags); 
    6163void free_locks(lock_list *ll); 
    6264int eval_lock(dbref player, dbref thing, lock_type ltype); 
     
    8587#define L_NEXT(lock) ((lock)->next) 
    8688/* can p read/evaluate lock l on object x? */ 
    87 int lock_visual(dbref, lock_type); 
     89BOOL lock_visual(dbref, lock_type); 
    8890#define Can_Read_Lock(p,x,l)   \ 
    8991    (See_All(p) || controls(p,x) || ((Visual(x) || lock_visual(x, l)) && \ 
  • 1.8.3/branches/devel/hdrs/mushtype.h

    r815 r874  
    44#ifdef HAS_OPENSSL 
    55#include <openssl/ssl.h> 
     6#endif 
     7#ifdef HAVE_STDINT_IN 
     8#include <stdint.h> 
    69#endif 
    710 
     
    1316 
    1417/** The type that stores the warning bitmask */ 
    15 typedef long int warn_type; 
     18typedef uint32_t warn_type; 
     19 
     20/** Attribute/lock flag types */ 
     21typedef uint32_t privbits; 
    1622 
    1723/* special dbref's */ 
  • 1.8.3/branches/devel/hdrs/privtab.h

    r521 r874  
    99#include "confmagic.h" 
    1010 
     11typedef struct priv_info PRIV; 
    1112 
    12 typedef struct priv_info PRIV; 
    1313/** Privileges. 
    1414 * This structure represents a privilege and its associated data. 
     
    1919  const char *name; /**< Name of the privilege */ 
    2020  char letter;      /**< One-letter abbreviation */ 
    21   long int bits_to_set;   /**< Bitflags required to set this privilege */ 
    22   long int bits_to_show;  /**< Bitflags required to see this privilege */ 
     21  privbits bits_to_set;   /**< Bitflags required to set this privilege */ 
     22  privbits bits_to_show;  /**< Bitflags required to see this privilege */ 
    2323}; 
    2424 
     
    2828#define PrivShowBits(x) ((x)->bits_to_show) 
    2929 
    30 extern int string_to_privs(PRIV *table, const char *str, long int origprivs); 
    31 extern int list_to_privs(PRIV *table, const char *str, long int origprivs); 
    32 extern int string_to_privsets(PRIV *table, const char *str, int *setprivs, 
    33                   int *clrprivs); 
    34 extern int letter_to_privs(PRIV *table, const char *str, long int origprivs); 
    35 extern const char *privs_to_string(PRIV *table, int privs); 
    36 extern const char *privs_to_letters(PRIV *table, int privs); 
     30privbits string_to_privs(PRIV *table, const char *str, privbits origprivs); 
     31privbits list_to_privs(PRIV *table, const char *str, privbits origprivs); 
     32int string_to_privsets(PRIV *table, const char *str, privbits *setprivs, 
     33                  privbits *clrprivs); 
     34privbits letter_to_privs(PRIV *table, const char *str, 
     35                privbits origprivs); 
     36extern const char *privs_to_string(PRIV *table, privbits privs); 
     37extern const char *privs_to_letters(PRIV *table, privbits privs); 
    3738 
    3839#endif              /* __PRIVTAB_H */ 
  • 1.8.3/branches/devel/hdrs/ptab.h

    r417 r874  
    1010 */ 
    1111typedef struct ptab { 
    12   int state;          /**< Internal table state */ 
    13   int len;            /**< Table size */ 
    14   int maxlen;         /**< Maximum table size */ 
    15   int current;            /**< Internal table state */ 
     12  BOOL state;         /**< Internal table state */ 
     13  size_t len;         /**< Table size */ 
     14  size_t maxlen;      /**< Maximum table size */ 
     15  size_t current;         /**< Internal table state */ 
    1616  struct ptab_entry **tab;  /**< Pointer to array of entries */ 
    1717} PTAB; 
  • 1.8.3/branches/devel/src/access.c

    r790 r874  
    238238  acsflag *c; 
    239239 
    240   sprintf(tmpf, "%s.tmp", ACCESS_FILE); 
     240  snprintf(tmpf, BUFFER_LEN, "%s.tmp", ACCESS_FILE); 
    241241  /* Be sure we have a file descriptor */ 
    242242  release_fd(); 
     
    510510  tmp->cant = cant; 
    511511  strcpy(tmp->host, host); 
    512   sprintf(tmp->comment, "By %s(#%d) on %s", Name(player), player, 
    513       show_time(mudtime, 0)); 
     512  snprintf(tmp->comment, sizeof tmp->comment,  
     513      "By %s(#%d) on %s", Name(player), player, show_time(mudtime, 0)); 
    514514  tmp->next = NULL; 
    515515 
  • 1.8.3/branches/devel/src/atr_tab.c

    r815 r874  
    177177{ 
    178178  ATTR *ap, *ap2; 
    179   int flags = 0; 
     179  privbits flags = 0; 
    180180  int i; 
    181181  int insert = 0; 
  • 1.8.3/branches/devel/src/attrib.c

    r825 r874  
    198198 * \param player the dbref to use for privilege checks. 
    199199 * \param p a space-separated string of attribute flags. 
    200  * \return an attribute flag bitmask. 
     200 * \param bits pointer to a privbits to store the attribute flags mask. 
     201 * \return 0 on success, -1 on error 
    201202 */ 
    202203int 
    203 string_to_atrflag(dbref player, char const *p
    204 { 
    205   int f; 
     204string_to_atrflag(dbref player, char const *p, privbits *bits
     205{ 
     206  privbits f; 
    206207  f = string_to_privs(attr_privs_set, p, 0); 
    207208  if (!f) 
     
    212213    return -1; 
    213214  f &= ~AF_INTERNAL; 
    214   return f; 
     215  *bits = f; 
     216  return 0; 
    215217} 
    216218 
     
    223225 * \param setbits pointer to address of bitmask to set. 
    224226 * \param clrbits pointer to address of bitmask to clear. 
    225  * \return setbits or -1 on error. 
     227 * \return 0 on success or -1 on error. 
    226228 */ 
    227229int 
    228 string_to_atrflagsets(dbref player, char const *p, int *setbits, int *clrbits) 
     230string_to_atrflagsets(dbref player, char const *p, privbits *setbits, 
     231              privbits *clrbits) 
    229232{ 
    230233  int f; 
     
    237240  if (!See_All(player) && ((*setbits & AF_WIZARD) || (*clrbits & AF_WIZARD))) 
    238241    return -1; 
    239   f &= ~AF_INTERNAL; 
    240   return *setbits; 
     242  return 0; 
    241243} 
    242244 
     
    247249 */ 
    248250const char * 
    249 atrflag_to_string(int mask) 
     251atrflag_to_string(privbits mask) 
    250252{ 
    251253  return privs_to_string(attr_privs_view, mask); 
     
    528530void 
    529531atr_new_add(dbref thing, const char *RESTRICT atr, const char *RESTRICT s, 
    530         dbref player, unsigned int flags, unsigned char derefs) 
     532