Use 'long int', 'short int', 'unsigned int'

etc. consistently instead of 'long', 'short', 'unsigned' etc.
This commit is contained in:
Paul Eggert 2004-03-30 07:55:25 +00:00
parent 7bf4578303
commit 7bcfe7aa19
7 changed files with 50 additions and 31 deletions

View File

@ -1,3 +1,21 @@
2004-03-29 Paul Eggert <eggert@twinsun.com>
* doc/autoconf.texi (Particular Headers, Particular Types, Generic
Types, Specific Compiler Characteristics, System Services,
Obsolete Macros): Use 'long int', 'short int', 'unsigned int'
etc. consistently instead of 'long', 'short', 'unsigned' etc.
* lib/autoconf/c.m4 (AC_LANG_INT_SAVE(C), AC_C_BIGENDIAN): Likewise.
* lib/autoconf/functions.m4 (AC_FUNC_MMAP, AC_FUNC_SELECT_ARGTYPES):
Likewise.
* lib/autoconf/headers.m4 (AC_HEADER_SYS_WAIT): Likewise.
* lib/autoconf/types.m4 (AC_TYPE_GETGROUPS, AC_TYPE_SIZE_T,
AC_TYPE_OFF_T): Likewise.
* tests/semantics.at (AC_CHECK_TYPES: backward compatibility):
Likewise.
* tests/foreign.at (Libtool): Create an empty aclocal.m4, to
pacify libtool 1.5.2. Fix quoting problems in sed command.
2004-03-28 Paul Eggert <eggert@twinsun.com>
* doc/autoconf.texi (Particular Structures): AC_STRUCT_TIMEZONE

View File

@ -4784,7 +4784,7 @@ example:
# include <sys/wait.h>
#endif
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
#endif
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
@ -5188,7 +5188,7 @@ Equivalent to @samp{AC_CHECK_TYPE(mode_t, int)}.
@defmac AC_TYPE_OFF_T
@acindex{TYPE_OFF_T}
@cvindex off_t
Equivalent to @samp{AC_CHECK_TYPE(off_t, long)}.
Equivalent to @samp{AC_CHECK_TYPE(off_t, long int)}.
@end defmac
@defmac AC_TYPE_PID_T
@ -5221,7 +5221,7 @@ hup_handler ()
@defmac AC_TYPE_SIZE_T
@acindex{TYPE_SIZE_T}
@cvindex size_t
Equivalent to @samp{AC_CHECK_TYPE(size_t, unsigned)}.
Equivalent to @samp{AC_CHECK_TYPE(size_t, unsigned int)}.
@end defmac
@defmac AC_TYPE_UID_T
@ -5257,7 +5257,7 @@ it is executed when one of the types is not found.
This macro uses m4 lists:
@example
AC_CHECK_TYPES(ptrdiff_t)
AC_CHECK_TYPES([unsigned long long, uintmax_t])
AC_CHECK_TYPES([unsigned long long int, uintmax_t])
@end example
@end defmac
@ -5308,14 +5308,14 @@ Some compilers exhibit different behaviors.
Autoconf relies on a trick to extract one bit of information from the C
compiler: using negative array sizes. For instance the following
excerpt of a C source demonstrates how to test whether @samp{int}s are 4
bytes long:
bytes wide:
@example
int
main (void)
@{
static int test_array [sizeof (int) == 4 ? 1 : -1];
test_array [0] = 0
test_array [0] = 0;
return 0;
@}
@end example
@ -5332,7 +5332,7 @@ cc: "conftest.c": error 1879: Variable-length arrays cannot \
@end example
Autoconf works around this problem by casting @code{sizeof (int)} to
@code{long} before comparing it.
@code{long int} before comparing it.
@end table
@node Generic Compiler Characteristics
@ -6176,10 +6176,10 @@ Large-file support can be disabled by configuring with the
@option{--disable-largefile} option.
If you use this macro, check that your program works even when
@code{off_t} is longer than @code{long}, since this is common when
@code{off_t} is wider than @code{long int}, since this is common when
large-file support is enabled. For example, it is not correct to print
an arbitrary @code{off_t} value @code{X} with @code{printf ("%ld",
(long) X)}.
(long int) X)}.
The LFS introduced the @code{fseeko} and @code{ftello} functions to
replace their C counterparts @code{fseek} and @code{ftell} that do not
@ -13444,7 +13444,7 @@ This use of @code{AC_CHECK_TYPE} is obsolete and discouraged; see
@ref{Generic Types}, for the description of the current macro.
If the type @var{type} is not defined, define it to be the C (or C++)
builtin type @var{default}, e.g., @samp{short} or @samp{unsigned}.
builtin type @var{default}, e.g., @samp{short int} or @samp{unsigned int}.
This macro is equivalent to:

View File

@ -242,8 +242,8 @@ test_array @<:@0@:>@ = 0
# But we include them only after the EXPRESSION has been evaluated.
m4_define([AC_LANG_INT_SAVE(C)],
[AC_LANG_PROGRAM([$1
long longval () { return $2; }
unsigned long ulongval () { return $2; }
long int longval () { return $2; }
unsigned long int ulongval () { return $2; }
@%:@include <stdio.h>
@%:@include <stdlib.h>],
[
@ -252,14 +252,14 @@ unsigned long ulongval () { return $2; }
exit (1);
if (($2) < 0)
{
long i = longval ();
long int i = longval ();
if (i != ($2))
exit (1);
fprintf (f, "%ld\n", i);
}
else
{
unsigned long i = ulongval ();
unsigned long int i = ulongval ();
if (i != ($2))
exit (1);
fprintf (f, "%lu\n", i);
@ -966,22 +966,22 @@ main ()
/* Are we little or big endian? From Harbison&Steele. */
union
{
long l;
char c[sizeof (long)];
long int l;
char c[sizeof (long int)];
} u;
u.l = 1;
exit (u.c[sizeof (long) - 1] == 1);
exit (u.c[sizeof (long int) - 1] == 1);
}]])],
[ac_cv_c_bigendian=no],
[ac_cv_c_bigendian=yes],
[# try to guess the endianness by grepping values into an object file
ac_cv_c_bigendian=unknown
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
[[short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }]],
[[ _ascii (); _ebcdic (); ]])],
[if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then

View File

@ -1,6 +1,6 @@
# This file is part of Autoconf. -*- Autoconf -*-
# Checking for functions.
# Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -1227,7 +1227,7 @@ main ()
data2 = (char *) malloc (2 * pagesize);
if (!data2)
exit (1);
data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1);
data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1);
if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_FIXED, fd, 0L))
exit (1);
@ -1345,7 +1345,7 @@ AC_DEFUN([AC_FUNC_SELECT_ARGTYPES],
AC_CACHE_CHECK([types of arguments for select],
[ac_cv_func_select_args],
[for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do
for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
@ -1671,7 +1671,7 @@ AC_DEFUN([AC_FUNC_UTIME_NULL],
AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[struct stat s, t;
exit (!(stat ("conftest.data", &s) == 0
&& utime ("conftest.data", (long *)0) == 0
&& utime ("conftest.data", 0) == 0
&& stat ("conftest.data", &t) == 0
&& t.st_mtime >= s.st_mtime
&& t.st_mtime - s.st_mtime < 120));]])],

View File

@ -629,7 +629,7 @@ AC_DEFUN([AC_HEADER_SYS_WAIT],
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/wait.h>
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
#endif
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)

View File

@ -263,7 +263,7 @@ main ()
{
gid_t gidset[NGID];
int i, n;
union { gid_t gval; long lval; } val;
union { gid_t gval; long int lval; } val;
val.lval = -1;
for (i = 0; i < NGID; i++)
@ -271,7 +271,8 @@ main ()
n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
gidset);
/* Exit non-zero if getgroups seems to require an array of ints. This
happens when gid_t is short but getgroups modifies an array of ints. */
happens when gid_t is short int but getgroups modifies an array
of ints. */
exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0);
}]])],
[ac_cv_type_getgroups=gid_t],
@ -333,13 +334,13 @@ fi
AN_IDENTIFIER([size_t], [AC_TYPE_SIZE_T])
AC_DEFUN([AC_TYPE_SIZE_T], [AC_CHECK_TYPE(size_t, unsigned)])
AC_DEFUN([AC_TYPE_SIZE_T], [AC_CHECK_TYPE(size_t, unsigned int)])
AN_IDENTIFIER([pid_t], [AC_TYPE_PID_T])
AC_DEFUN([AC_TYPE_PID_T], [AC_CHECK_TYPE(pid_t, int)])
AN_IDENTIFIER([off_t], [AC_TYPE_OFF_T])
AC_DEFUN([AC_TYPE_OFF_T], [AC_CHECK_TYPE(off_t, long)])
AC_DEFUN([AC_TYPE_OFF_T], [AC_CHECK_TYPE(off_t, long int)])
AN_IDENTIFIER([mode_t], [AC_TYPE_MODE_T])
AC_DEFUN([AC_TYPE_MODE_T], [AC_CHECK_TYPE(mode_t, int)])

View File

@ -340,7 +340,7 @@ define([_AC_CHECK_TYPE_OLD], [OLD])
#(cut-from-here
AC_CHECK_TYPE(ptrdiff_t)
AC_CHECK_TYPE(ptrdiff_t, int)
AC_CHECK_TYPE(quad, long long)
AC_CHECK_TYPE(quad, long long int)
AC_CHECK_TYPE(table_42, [int[42]])
# Nice machine!
AC_CHECK_TYPE(uint8_t, uint65536_t)