Paul Eggert wrote: > Here are some proposed changes to the gnulib allocsa and vasnprintf > modules prompted by the needs of porting coreutils to Tandem NSK > (OSS), along with modernizing the code to use the newer macros like > AC_TYPE_LONG_LONG_INT rather than the older macros like > gl_AC_TYPE_LONG_LONG.
This is unfortunately two patches in one, with few comments. I'm applying the first part first: 2006-10-11 Paul Eggert <[EMAIL PROTECTED]> Bruno Haible <[EMAIL PROTECTED]> * lib/allocsa.h (sa_alignment_longlong, sa_alignment_max): Test HAVE_LONG_LONG_INT instead of HAVE_LONG_LONG. * m4/allocsa.m4 (gl_ALLOCSA): Invoke AC_TYPE_LONG_LONG_INT instead of gl_AC_TYPE_LONG_LONG. * lib/printf-args.h (arg_type, argument): Test HAVE_LONG_LONG_INT instead of HAVE_LONG_LONG. * lib/printf-args.c (printf_fetchargs): Likewise. * lib/printf-parse.c (PRINTF_PARSE): Likewise. * lib/vasnprintf.c (VASNPRINTF): Likewise. * m4/vasnprintf.m4 (gl_PREREQ_PRINTF_ARGS, gl_PREREQ_PRINTF_PARSE, gl_PREREQ_VASNPRINTF): Invoke AC_TYPE_LONG_LONG_INT instead of gl_AC_TYPE_LONG_LONG. diff -c -3 -r1.6 allocsa.h *** lib/allocsa.h 8 Aug 2006 13:11:11 -0000 1.6 --- lib/allocsa.h 11 Oct 2006 15:53:14 -0000 *************** *** 106,119 **** among all elementary types. */ sa_alignment_long = sa_alignof (long), sa_alignment_double = sa_alignof (double), ! #ifdef HAVE_LONG_LONG sa_alignment_longlong = sa_alignof (long long), #endif #ifdef HAVE_LONG_DOUBLE sa_alignment_longdouble = sa_alignof (long double), #endif sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) ! #ifdef HAVE_LONG_LONG | (sa_alignment_longlong - 1) #endif #ifdef HAVE_LONG_DOUBLE --- 106,119 ---- among all elementary types. */ sa_alignment_long = sa_alignof (long), sa_alignment_double = sa_alignof (double), ! #ifdef HAVE_LONG_LONG_INT sa_alignment_longlong = sa_alignof (long long), #endif #ifdef HAVE_LONG_DOUBLE sa_alignment_longdouble = sa_alignof (long double), #endif sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) ! #ifdef HAVE_LONG_LONG_INT | (sa_alignment_longlong - 1) #endif #ifdef HAVE_LONG_DOUBLE diff -c -3 -r1.7 printf-args.c *** lib/printf-args.c 14 Sep 2006 14:18:36 -0000 1.7 --- lib/printf-args.c 11 Oct 2006 15:53:14 -0000 *************** *** 56,62 **** case TYPE_ULONGINT: ap->a.a_ulongint = va_arg (args, unsigned long int); break; ! #ifdef HAVE_LONG_LONG case TYPE_LONGLONGINT: ap->a.a_longlongint = va_arg (args, long long int); break; --- 56,62 ---- case TYPE_ULONGINT: ap->a.a_ulongint = va_arg (args, unsigned long int); break; ! #ifdef HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: ap->a.a_longlongint = va_arg (args, long long int); break; *************** *** 128,134 **** case TYPE_COUNT_LONGINT_POINTER: ap->a.a_count_longint_pointer = va_arg (args, long int *); break; ! #ifdef HAVE_LONG_LONG case TYPE_COUNT_LONGLONGINT_POINTER: ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); break; --- 128,134 ---- case TYPE_COUNT_LONGINT_POINTER: ap->a.a_count_longint_pointer = va_arg (args, long int *); break; ! #ifdef HAVE_LONG_LONG_INT case TYPE_COUNT_LONGLONGINT_POINTER: ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); break; diff -c -3 -r1.4 printf-args.h *** lib/printf-args.h 14 May 2005 06:03:58 -0000 1.4 --- lib/printf-args.h 11 Oct 2006 15:53:14 -0000 *************** *** 1,5 **** /* Decomposed printf argument list. ! Copyright (C) 1999, 2002-2003 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 --- 1,5 ---- /* Decomposed printf argument list. ! Copyright (C) 1999, 2002-2003, 2006 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 *************** *** 47,53 **** TYPE_UINT, TYPE_LONGINT, TYPE_ULONGINT, ! #ifdef HAVE_LONG_LONG TYPE_LONGLONGINT, TYPE_ULONGLONGINT, #endif --- 47,53 ---- TYPE_UINT, TYPE_LONGINT, TYPE_ULONGINT, ! #ifdef HAVE_LONG_LONG_INT TYPE_LONGLONGINT, TYPE_ULONGLONGINT, #endif *************** *** 68,74 **** TYPE_COUNT_SHORT_POINTER, TYPE_COUNT_INT_POINTER, TYPE_COUNT_LONGINT_POINTER ! #ifdef HAVE_LONG_LONG , TYPE_COUNT_LONGLONGINT_POINTER #endif } arg_type; --- 68,74 ---- TYPE_COUNT_SHORT_POINTER, TYPE_COUNT_INT_POINTER, TYPE_COUNT_LONGINT_POINTER ! #ifdef HAVE_LONG_LONG_INT , TYPE_COUNT_LONGLONGINT_POINTER #endif } arg_type; *************** *** 87,93 **** unsigned int a_uint; long int a_longint; unsigned long int a_ulongint; ! #ifdef HAVE_LONG_LONG long long int a_longlongint; unsigned long long int a_ulonglongint; #endif --- 87,93 ---- unsigned int a_uint; long int a_longint; unsigned long int a_ulongint; ! #ifdef HAVE_LONG_LONG_INT long long int a_longlongint; unsigned long long int a_ulonglongint; #endif *************** *** 109,115 **** short * a_count_short_pointer; int * a_count_int_pointer; long int * a_count_longint_pointer; ! #ifdef HAVE_LONG_LONG long long int * a_count_longlongint_pointer; #endif } --- 109,115 ---- short * a_count_short_pointer; int * a_count_int_pointer; long int * a_count_longint_pointer; ! #ifdef HAVE_LONG_LONG_INT long long int * a_count_longlongint_pointer; #endif } diff -c -3 -r1.7 printf-parse.c *** lib/printf-parse.c 14 Sep 2006 14:18:36 -0000 1.7 --- lib/printf-parse.c 11 Oct 2006 15:53:14 -0000 *************** *** 382,392 **** switch (c) { case 'd': case 'i': ! #ifdef HAVE_LONG_LONG if (flags >= 16 || (flags & 4)) type = TYPE_LONGLONGINT; else #endif if (flags >= 8) type = TYPE_LONGINT; else if (flags & 2) --- 382,395 ---- switch (c) { case 'd': case 'i': ! #ifdef HAVE_LONG_LONG_INT ! /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_LONGLONGINT; else #endif + /* If 'long long' exists and is the same as 'long', we parse + "lld" into TYPE_LONGINT. */ if (flags >= 8) type = TYPE_LONGINT; else if (flags & 2) *************** *** 397,407 **** type = TYPE_INT; break; case 'o': case 'u': case 'x': case 'X': ! #ifdef HAVE_LONG_LONG if (flags >= 16 || (flags & 4)) type = TYPE_ULONGLONGINT; else #endif if (flags >= 8) type = TYPE_ULONGINT; else if (flags & 2) --- 400,413 ---- type = TYPE_INT; break; case 'o': case 'u': case 'x': case 'X': ! #ifdef HAVE_LONG_LONG_INT ! /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_ULONGLONGINT; else #endif + /* If 'unsigned long long' exists and is the same as + 'unsigned long', we parse "llu" into TYPE_ULONGINT. */ if (flags >= 8) type = TYPE_ULONGINT; else if (flags & 2) *************** *** 456,466 **** type = TYPE_POINTER; break; case 'n': ! #ifdef HAVE_LONG_LONG if (flags >= 16 || (flags & 4)) type = TYPE_COUNT_LONGLONGINT_POINTER; else #endif if (flags >= 8) type = TYPE_COUNT_LONGINT_POINTER; else if (flags & 2) --- 462,475 ---- type = TYPE_POINTER; break; case 'n': ! #ifdef HAVE_LONG_LONG_INT ! /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_COUNT_LONGLONGINT_POINTER; else #endif + /* If 'long long' exists and is the same as 'long', we parse + "lln" into TYPE_COUNT_LONGINT_POINTER. */ if (flags >= 8) type = TYPE_COUNT_LONGINT_POINTER; else if (flags & 2) diff -c -3 -r1.20 vasnprintf.c *** lib/vasnprintf.c 14 Sep 2006 14:18:36 -0000 1.20 --- lib/vasnprintf.c 11 Oct 2006 15:53:14 -0000 *************** *** 248,254 **** case TYPE_COUNT_LONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longint_pointer = length; break; ! #ifdef HAVE_LONG_LONG case TYPE_COUNT_LONGLONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; break; --- 248,254 ---- case TYPE_COUNT_LONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longint_pointer = length; break; ! #ifdef HAVE_LONG_LONG_INT case TYPE_COUNT_LONGLONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; break; *************** *** 322,328 **** { case 'd': case 'i': case 'u': ! # ifdef HAVE_LONG_LONG if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT --- 322,328 ---- { case 'd': case 'i': case 'u': ! # ifdef HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT *************** *** 352,358 **** break; case 'o': ! # ifdef HAVE_LONG_LONG if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT --- 352,358 ---- break; case 'o': ! # ifdef HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT *************** *** 380,386 **** break; case 'x': case 'X': ! # ifdef HAVE_LONG_LONG if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT --- 380,386 ---- break; case 'x': case 'X': ! # ifdef HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT *************** *** 527,533 **** switch (type) { ! #ifdef HAVE_LONG_LONG case TYPE_LONGLONGINT: case TYPE_ULONGLONGINT: *p++ = 'l'; --- 527,533 ---- switch (type) { ! #ifdef HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: case TYPE_ULONGLONGINT: *p++ = 'l'; *************** *** 681,687 **** SNPRINTF_BUF (arg); } break; ! #ifdef HAVE_LONG_LONG case TYPE_LONGLONGINT: { long long int arg = a.arg[dp->arg_index].a.a_longlongint; --- 681,687 ---- SNPRINTF_BUF (arg); } break; ! #ifdef HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: { long long int arg = a.arg[dp->arg_index].a.a_longlongint; diff -c -3 -r1.3 allocsa.m4 *** m4/allocsa.m4 18 Jan 2005 13:07:56 -0000 1.3 --- m4/allocsa.m4 11 Oct 2006 15:53:14 -0000 *************** *** 1,5 **** ! # allocsa.m4 serial 3 ! dnl Copyright (C) 2003-2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. --- 1,5 ---- ! # allocsa.m4 serial 4 ! dnl Copyright (C) 2003-2004, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. *************** *** 10,15 **** dnl @ALLOCA@ and @[EMAIL PROTECTED] AC_REQUIRE([gl_FUNC_ALLOCA]) AC_REQUIRE([gl_EEMALLOC]) ! AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) ]) --- 10,15 ---- dnl @ALLOCA@ and @[EMAIL PROTECTED] AC_REQUIRE([gl_FUNC_ALLOCA]) AC_REQUIRE([gl_EEMALLOC]) ! AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) ]) diff -c -3 -r1.8 vasnprintf.m4 *** m4/vasnprintf.m4 18 Jan 2005 13:07:56 -0000 1.8 --- m4/vasnprintf.m4 11 Oct 2006 15:53:14 -0000 *************** *** 1,5 **** ! # vasnprintf.m4 serial 5 ! dnl Copyright (C) 2002-2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. --- 1,5 ---- ! # vasnprintf.m4 serial 6 ! dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. *************** *** 23,29 **** AC_DEFUN([gl_PREREQ_PRINTF_ARGS], [ AC_REQUIRE([bh_C_SIGNED]) ! AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) --- 23,29 ---- AC_DEFUN([gl_PREREQ_PRINTF_ARGS], [ AC_REQUIRE([bh_C_SIGNED]) ! AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) *************** *** 32,38 **** # Prequisites of lib/printf-parse.h, lib/printf-parse.c. AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ ! AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) --- 32,38 ---- # Prequisites of lib/printf-parse.h, lib/printf-parse.c. AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ ! AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) *************** *** 45,51 **** AC_DEFUN([gl_PREREQ_VASNPRINTF], [ AC_REQUIRE([AC_FUNC_ALLOCA]) ! AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) --- 45,51 ---- AC_DEFUN([gl_PREREQ_VASNPRINTF], [ AC_REQUIRE([AC_FUNC_ALLOCA]) ! AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils