[PATCH 2/4] git-merge-changelog: ssize_t → ptrdiff_t
Prefer ptrdiff_t to ssize_t, as per <https://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00019.html>. * lib/git-merge-changelog.c (struct entries_mapping) (entries_mapping_get, entries_mapping_reverse_get) (compute_mapping, struct edit, struct differences, OFFSET) (OFFSET_MAX, EXTRA_CONTEXT_FIELDS, compute_differences, main): Use ptrdiff_t, not ssize_t. * modules/git-merge-changelog (Depends-on): Add stdint for PTRDIFF_MAX. --- ChangeLog | 10 lib/git-merge-changelog.c | 109 ++-- modules/git-merge-changelog | 1 + 3 files changed, 66 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index bed79ab76b..611a8e5014 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2023-05-21 Paul Eggert + git-merge-changelog: ssize_t → ptrdiff_t + Prefer ptrdiff_t to ssize_t, as per + <https://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00019.html>. + * lib/git-merge-changelog.c (struct entries_mapping) + (entries_mapping_get, entries_mapping_reverse_get) + (compute_mapping, struct edit, struct differences, OFFSET) + (OFFSET_MAX, EXTRA_CONTEXT_FIELDS, compute_differences, main): + Use ptrdiff_t, not ssize_t. + * modules/git-merge-changelog (Depends-on): Add stdint for PTRDIFF_MAX. + git-merge-changelog: port to ssize_t padding * lib/git-merge-changelog.c (OFFSET_MAX): New macro, as a nicety. diff --git a/lib/git-merge-changelog.c b/lib/git-merge-changelog.c index 16d874bd04..3e749ed59d 100644 --- a/lib/git-merge-changelog.c +++ b/lib/git-merge-changelog.c @@ -157,6 +157,7 @@ #include #include +#include #include #include #include @@ -372,18 +373,18 @@ struct entries_mapping /* Mapping from indices in FILE1 to indices in FILE2. A value -1 means that the entry from FILE1 is not found in FILE2. A value -2 means that it has not yet been computed. */ - ssize_t *index_mapping; + ptrdiff_t *index_mapping; /* Mapping from indices in FILE2 to indices in FILE1. A value -1 means that the entry from FILE2 is not found in FILE1. A value -2 means that it has not yet been computed. */ - ssize_t *index_mapping_reverse; + ptrdiff_t *index_mapping_reverse; }; /* Look up (or lazily compute) the mapping of an entry in FILE1. i is the index in FILE1. Return the index in FILE2, or -1 when the entry is not found in FILE2. */ -static ssize_t -entries_mapping_get (struct entries_mapping *mapping, ssize_t i) +static ptrdiff_t +entries_mapping_get (struct entries_mapping *mapping, ptrdiff_t i) { if (mapping->index_mapping[i] < -1) { @@ -392,10 +393,10 @@ entries_mapping_get (struct entries_mapping *mapping, ssize_t i) size_t n1 = file1->num_entries; size_t n2 = file2->num_entries; struct entry *entry_i = file1->entries[i]; - ssize_t j; + ptrdiff_t j; /* Search whether it approximately occurs in file2. */ - ssize_t best_j = -1; + ptrdiff_t best_j = -1; double best_j_similarity = 0.0; for (j = n2 - 1; j >= 0; j--) if (mapping->index_mapping_reverse[j] < 0) @@ -413,9 +414,9 @@ entries_mapping_get (struct entries_mapping *mapping, ssize_t i) /* Found a similar entry in file2. */ struct entry *entry_j = file2->entries[best_j]; /* Search whether it approximately occurs in file1 at index i. */ - ssize_t best_i = -1; + ptrdiff_t best_i = -1; double best_i_similarity = 0.0; - ssize_t ii; + ptrdiff_t ii; for (ii = n1 - 1; ii >= 0; ii--) if (mapping->index_mapping[ii] < 0) { @@ -445,8 +446,8 @@ entries_mapping_get (struct entries_mapping *mapping, ssize_t i) /* Look up (or lazily compute) the mapping of an entry in FILE2. j is the index in FILE2. Return the index in FILE1, or -1 when the entry is not found in FILE1. */ -static ssize_t -entries_mapping_reverse_get (struct entries_mapping *mapping, ssize_t j) +static ptrdiff_t +entries_mapping_reverse_get (struct entries_mapping *mapping, ptrdiff_t j) { if (mapping->index_mapping_reverse[j] < -1) { @@ -455,10 +456,10 @@ entries_mapping_reverse_get (struct entries_mapping *mapping, ssize_t j) size_t n1 = file1->num_entries; size_t n2 = file2->num_entries; struct entry *entry_j = file2->entries[j]; - ssize_t i; + ptrdiff_t i; /* Search whether it approximately occurs in file1. */ - ssize_t best_i = -1; + ptrdiff_t best_i = -1; double best_i_similarity = 0.0; for (i = n1 - 1; i >= 0; i--) if (mapping->index_mapping[i] < 0) @@ -476,9 +477,9 @@ entries_mapping_reverse_get (struct entries_mapping *mapping, ssize_t j) /* Found a similar entry in file1. */ struct entry *entry_i = file1->entries[best
[PATCH 1/4] git-merge-changelog: port to ssize_t padding
* lib/git-merge-changelog.c (OFFSET_MAX): New macro, as a nicety. --- ChangeLog | 5 + lib/git-merge-changelog.c | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9cdb603b9b..bed79ab76b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2023-05-21 Paul Eggert + + git-merge-changelog: port to ssize_t padding + * lib/git-merge-changelog.c (OFFSET_MAX): New macro, as a nicety. + 2023-05-21 Bruno Haible limits-h tests: Check the value of SSIZE_MAX. diff --git a/lib/git-merge-changelog.c b/lib/git-merge-changelog.c index 67a932c5df..16d874bd04 100644 --- a/lib/git-merge-changelog.c +++ b/lib/git-merge-changelog.c @@ -639,6 +639,7 @@ struct differences #define ELEMENT struct entry * #define EQUAL entry_equals #define OFFSET ssize_t +#define OFFSET_MAX SSIZE_MAX #define EXTRA_CONTEXT_FIELDS \ ssize_t *index_mapping; \ ssize_t *index_mapping_reverse; -- 2.39.2
[PATCH 1/2] diffseq: prefer ptrdiff_t to ssize_t
* lib/diffseq.h: In commentary, prefer ptrdiff_t to ssize_t. ptrdiff_t is the natural type for signed indexes. On a few older platforms, ssize_t is narrower than size_t. --- ChangeLog | 5 + lib/diffseq.h | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 774903e..3207028 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2015-02-07 Paul Eggert egg...@cs.ucla.edu + diffseq: prefer ptrdiff_t to ssize_t + * lib/diffseq.h: In commentary, prefer ptrdiff_t to ssize_t. + ptrdiff_t is the natural type for signed indexes. + On a few older platforms, ssize_t is narrower than size_t. + xalloc: fix typo that suppressed warnings * lib/xalloc.h: Add missing _GL_INLINE_HEADER_END. This typo, introduced a couple of years ago, mistakenly suppressed diff --git a/lib/diffseq.h b/lib/diffseq.h index b418830..a4f389a 100644 --- a/lib/diffseq.h +++ b/lib/diffseq.h @@ -41,8 +41,8 @@ EQUAL A two-argument macro that tests two elements for equality. OFFSET A signed integer type sufficient to hold the - difference between two indices. Usually - something like ssize_t. + difference between two indices. Usually + something like ptrdiff_t. EXTRA_CONTEXT_FIELDSDeclarations of fields for 'struct context'. NOTE_DELETE(ctxt, xoff) Record the removal of the object xvec[xoff]. NOTE_INSERT(ctxt, yoff) Record the insertion of the object yvec[yoff]. -- 2.1.0
Re: [PATCH] ssize_t: fix definition on mingw
Hi Eric, We were blindly defining ssize_t to int. On mingw64, this is the correct size, but the wrong rank, which leads gcc to issue warnings for %zd printf directives. * m4/ssize_t.m4 (gt_TYPE_SSIZE_T): Match rank of size_t. This patch will not help to fix Daniel Berrange's problem. In mingw and mingw64, ssize_t is defined by sys/types.h, and gnulib will not override it. Test program: foo.c = #include sys/types.h size_t a; ssize_t b; With mingw of 2009: $ gcc -mno-cygwin -c foo.c $ gcc -mno-cygwin -E foo.c | grep size_t typedef unsigned int size_t; typedef long _ssize_t; typedef _ssize_t ssize_t; size_t a; ssize_t b; With mingw of 2011: $ i686-pc-mingw32-gcc -c foo.c $ i686-pc-mingw32-gcc -E foo.c | grep size_t typedef unsigned int size_t; typedef int _ssize_t; typedef _ssize_t ssize_t; size_t a; ssize_t b; With mingw64 of 2011: $ i686-w64-mingw32-gcc -c foo.c $ i686-w64-mingw32-gcc -E foo.c | grep size_t typedef unsigned int size_t; typedef int ssize_t; size_t a; ssize_t b; This is consistent with what doc/posix-headers/sys_types.texi says: @item The type @code{ssize_t} is not defined on some platforms: MSVC 9. Bruno, is this okay to apply? No. Even if it would help, there would be a few nits: +AC_CACHE_CHECK([for rank of size_t], [gt_cv_size_t_rank], Better say integer conversion rank, since that's the term ISO C 99 uses (section 6.3.1.1). + [AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM( + [[#include sys/types.h + #ifdef __cplusplus Intentation problem. + extern C { + #endif +int foo(unsigned long bar); +int foo(size_t bar); You cannot look at size_t to determine what ssize_t should be: On MSVC 9, sys/types.h lacks both size_t and ssize_t. + ]])], + [gt_cv_size_t_rank=long], [gt_cv_size_t_rank=int])]) Another indentation problem. In summary, I would not do something about it in gnulib. The proper place for setting up size_t and ssize_t are GCC and sys/types.h. If gnulib would override the definition, it would have side effects on C++ overloading. For my feeling, that's not worth it. Simply ignore the GCC printf argument size warnings on mingw. Look at them only on glibc systems. Bruno
Re: [PATCH] ssize_t: fix definition on mingw
Eric Blake wrote: Then how do I explain the compiler warning that Daniel was seeing under mingw64? They come from disagreements regarding the integer conversion rank of 'size_t' and 'ssize_t' between GCC and sys/types.h. When you write printf(%zd,arg) then GCC compares its own built-in knowledge about 'ssize_t' being 'int' or 'long' with the type of the argument 'arg'. It reports mismatch between 'int' and 'long' also on 32-bit platforms (possibly with the intent of helping portability to 64-bit platforms). Bruno
Re: [PATCH] ssize_t: fix definition on mingw
On 04/05/2012 04:10 AM, Bruno Haible wrote: This patch will not help to fix Daniel Berrange's problem. In mingw and mingw64, ssize_t is defined by sys/types.h, and gnulib will not override it. Test program: foo.c = #include sys/types.h size_t a; ssize_t b; With mingw of 2009: $ gcc -mno-cygwin -c foo.c $ gcc -mno-cygwin -E foo.c | grep size_t typedef unsigned int size_t; typedef long _ssize_t; typedef _ssize_t ssize_t; size_t a; ssize_t b; Broken, but a thing of the past. With mingw of 2011: $ i686-pc-mingw32-gcc -c foo.c $ i686-pc-mingw32-gcc -E foo.c | grep size_t typedef unsigned int size_t; typedef int _ssize_t; typedef _ssize_t ssize_t; size_t a; ssize_t b; Working. With mingw64 of 2011: $ i686-w64-mingw32-gcc -c foo.c $ i686-w64-mingw32-gcc -E foo.c | grep size_t typedef unsigned int size_t; typedef int ssize_t; size_t a; ssize_t b; Working. You forgot to check one (64-bit mingw64): $ x86_64-w64-mingw32-gcc -E foo.c | grep size_t __extension__ typedef unsigned long long size_t; __extension__ typedef long long ssize_t; size_t a; ssize_t b; but apparently that is also working. Then how do I explain the compiler warning that Daniel was seeing under mingw64? Daniel, were you testing with x86_64-w64-mingw32-gcc or i686-w64-mingw32-gcc? Can you come up with a minimal test case that shows the issue you had? You cannot look at size_t to determine what ssize_t should be: On MSVC 9, sys/types.h lacks both size_t and ssize_t. In which case we are okay as long as we choose the same size for each. In summary, I would not do something about it in gnulib. The proper place for setting up size_t and ssize_t are GCC and sys/types.h. If gnulib would override the definition, it would have side effects on C++ overloading. For my feeling, that's not worth it. Simply ignore the GCC printf argument size warnings on mingw. Look at them only on glibc systems. But my problem is that there _shouldn't_ be any GCC printf warnings on mingw, if mingw headers are correct. -- Eric Blake ebl...@redhat.com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
[PATCH] ssize_t: fix definition on mingw
We were blindly defining ssize_t to int. On mingw64, this is the correct size, but the wrong rank, which leads gcc to issue warnings for %zd printf directives. * m4/ssize_t.m4 (gt_TYPE_SSIZE_T): Match rank of size_t. Signed-off-by: Eric Blake ebl...@redhat.com --- Bruno, is this okay to apply? ChangeLog |5 + m4/ssize_t.m4 | 20 +--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d74544a..768ab46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-03-29 Eric Blake ebl...@redhat.com + + ssize_t: fix definition on mingw + * m4/ssize_t.m4 (gt_TYPE_SSIZE_T): Match rank of size_t. + 2012-03-25 Bruno Haible br...@clisp.org Tests for module 'localeconv'. diff --git a/m4/ssize_t.m4 b/m4/ssize_t.m4 index 209d64c..5ea72a1 100644 --- a/m4/ssize_t.m4 +++ b/m4/ssize_t.m4 @@ -1,4 +1,4 @@ -# ssize_t.m4 serial 5 (gettext-0.18.2) +# ssize_t.m4 serial 6 (gettext-0.18.2) dnl Copyright (C) 2001-2003, 2006, 2010-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,7 +17,21 @@ AC_DEFUN([gt_TYPE_SSIZE_T], return !x;]])], [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) if test $gt_cv_ssize_t = no; then -AC_DEFINE([ssize_t], [int], - [Define as a signed type of the same size as size_t.]) +AC_CACHE_CHECK([for rank of size_t], [gt_cv_size_t_rank], + [AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM( + [[#include sys/types.h + #ifdef __cplusplus + extern C { + #endif +int foo(unsigned long bar); +int foo(size_t bar); + #ifdef __cplusplus + } + #endif + ]])], + [gt_cv_size_t_rank=long], [gt_cv_size_t_rank=int])]) +AC_DEFINE_UNQUOTED([ssize_t], [$gt_cv_size_t_rank], + [Define as a signed type of the same size and rank as size_t.]) fi ]) -- 1.7.7.6
Re: ssize_t on MSVC
I committed: --- tests/test-sys_socket.c.origThu Sep 15 17:57:52 2011 +++ tests/test-sys_socket.c Thu Sep 15 16:06:27 2011 @@ -30,6 +30,10 @@ /* Check that the 'socklen_t' type is defined. */ socklen_t t1; +/* Check that the 'size_t' and 'ssize_t' types are defined. */ +size_t t1; +ssize_t t2; + /* Check that 'struct iovec' is defined. */ struct iovec io; This is obviously wrong: 't1' defined twice. 2011-09-17 Bruno Haible br...@clisp.org sys_socket tests: Fix recent mistake. * tests/test-sys_socket.c (t1): Avoid collision of identifiers. --- tests/test-sys_socket.c.origSat Sep 17 17:39:10 2011 +++ tests/test-sys_socket.c Sat Sep 17 17:37:25 2011 @@ -31,8 +31,8 @@ socklen_t t1; /* Check that the 'size_t' and 'ssize_t' types are defined. */ -size_t t1; -ssize_t t2; +size_t t2; +ssize_t t3; /* Check that 'struct iovec' is defined. */ struct iovec io; -- In memoriam Estella Agsteribbe http://en.wikipedia.org/wiki/Estella_Agsteribbe
ssize_t on MSVC
On MSVC 9, ssize_t is not defined, leading to test compilation failures in test-stdio.c:36, test-sys_uio.c:25, test-unistd.c:40. According to POSIX:2008, ssize_t ought to be defined in each of stdio.h sys/socket.h sys/types.h sys/uio.h unistd.h This fixes it. 2011-09-15 Bruno Haible br...@clisp.org Support for MSVC compiler: Ensure ssize_t gets defined. * doc/posix-headers/sys_types.texi: Mention the missing ssize_t problem. * doc/posix-headers/stdio.texi: Likewise. * modules/stdio (Depends-on): Add ssize_t. * modules/sys_socket (Depends-on): Likewise. * modules/sys_types (Depends-on): Likewise. * modules/sys_uio (Depends-on): Likewise. * modules/unistd (Depends-on): Likewise. * tests/test-sys_socket.c: Check that size_t and ssize_t are defined. * tests/test-sys_types.c: Check that ssize_t is defined. --- doc/posix-headers/stdio.texi.orig Thu Sep 15 17:57:52 2011 +++ doc/posix-headers/stdio.texiThu Sep 15 16:10:15 2011 @@ -12,7 +12,7 @@ glibc 2.8, eglibc 2.11.2 and others. @item The type @code{ssize_t} is missing on some platforms: -glibc 2.8, MacOS X 10.5, Solaris 10, and others. +glibc 2.8, MacOS X 10.5, Solaris 10, MSVC 9, and others. @item The type @code{va_list} is missing on some platforms: glibc 2.8, OpenBSD 4.0, Solaris 11 2010-11, and others. --- doc/posix-headers/sys_types.texi.orig Thu Sep 15 17:57:52 2011 +++ doc/posix-headers/sys_types.texiThu Sep 15 16:10:15 2011 @@ -13,6 +13,9 @@ @item The type @code{size_t} is not defined in this file on some platforms: MSVC 9. +@item +The type @code{ssize_t} is not defined on some platforms: +MSVC 9. @end itemize Portability problems not fixed by Gnulib: --- modules/stdio.orig Thu Sep 15 17:57:52 2011 +++ modules/stdio Thu Sep 15 16:13:37 2011 @@ -10,6 +10,7 @@ snippet/arg-nonnull snippet/c++defs snippet/warn-on-use +ssize_t stddef configure.ac: --- modules/sys_socket.orig Thu Sep 15 17:57:52 2011 +++ modules/sys_socket Thu Sep 15 16:13:38 2011 @@ -14,6 +14,7 @@ snippet/c++defs snippet/warn-on-use socklen +ssize_t sys_uio configure.ac: --- modules/sys_types.orig Thu Sep 15 17:57:52 2011 +++ modules/sys_types Thu Sep 15 16:13:38 2011 @@ -7,6 +7,7 @@ Depends-on: include_next +ssize_t configure.ac: gl_SYS_TYPES_H --- modules/sys_uio.origThu Sep 15 17:57:52 2011 +++ modules/sys_uio Thu Sep 15 16:13:38 2011 @@ -7,6 +7,7 @@ Depends-on: include_next +ssize_t sys_types configure.ac: --- modules/unistd.orig Thu Sep 15 17:57:52 2011 +++ modules/unistd Thu Sep 15 16:13:38 2011 @@ -10,6 +10,7 @@ snippet/arg-nonnull snippet/c++defs snippet/warn-on-use +ssize_t stddef configure.ac: --- tests/test-sys_socket.c.origThu Sep 15 17:57:52 2011 +++ tests/test-sys_socket.c Thu Sep 15 16:06:27 2011 @@ -30,6 +30,10 @@ /* Check that the 'socklen_t' type is defined. */ socklen_t t1; +/* Check that the 'size_t' and 'ssize_t' types are defined. */ +size_t t1; +ssize_t t2; + /* Check that 'struct iovec' is defined. */ struct iovec io; --- tests/test-sys_types.c.orig Thu Sep 15 17:57:52 2011 +++ tests/test-sys_types.c Thu Sep 15 16:04:43 2011 @@ -23,6 +23,7 @@ /* Check that the types are all defined. */ pid_t t1; size_t t2; +ssize_t t3; int main (void) -- In memoriam Mala Zimetbaum http://en.wikipedia.org/wiki/Mala_Zimetbaum
Re: ssize_t on MSVC
On 09/15/2011 10:08 AM, Bruno Haible wrote: On MSVC 9, ssize_t is not defined, leading to test compilation failures in test-stdio.c:36, test-sys_uio.c:25, test-unistd.c:40. According to POSIX:2008, ssize_t ought to be defined in each of stdio.h sys/socket.h sys/types.h sys/uio.h unistd.h For the record, POSIX 2008 also requires ssize_t in these headers (but we don't care right now, as we lack gnulib wrappers): aio.h monetary.h mqueue.h sys/msg.h -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org
Re: getline.c and ssize_t
Micah Cowan wrote: While attempting to compile sed from current CVS, I ran across the following output from bootstrap.sh: + cc -DHAVE_CONFIG_H -I.. -I. -c getline.c getline.c:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘getline’ Line 26 is the ssize_t return-type of getline. Adding #include unistd.h fixed it (I'm sure sys/types.h would too). Unfortunately, after fixing that, I ran into cc: mbchar.c: No such file or directory which I suspect to be just sed's bootstrap not being up-to-date with current gnulib Everything looks correct in the current gnulib; in particular ssize_t gets defined by sys/types.h, included by gnulib's stdio.h override. Therefore I suspect, like you, that the use of gnulib in sed is not up-to-date; please write to the email address in `sed --help` about this. Bruno
Re: ssize_t
Simon Josefsson wrote: GnuTLS need ssize_t, but there is no module for it right now. How about the patch below? Looks OK to me. I'm not sure what the License field for ssize_t.m4 should be. The M4 file says: dnl Copyright (C) 2001-2003 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. What do we call this? I wrote public domain, but that seem incorrect. I would write LGPL, since it's usable in libraries. (The License statement effectively does not apply to the *.m4 files, therefore here we're talking about the license of an empty set of *.[hc] files.) Bruno ___ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib
Re: Non-standard types in public header files (was: Re: ssize_t)
Hello, this mail is a lengthy story to the most abstract solution and back to the basic one. Sorry, I couldn't have helped. The problem, of course, is that the installed header file cannot assume a config.h and the HAVE_* stuff. Indeed, this is the root of the problem. You try to find a solution which works without config.h. But this means that the installed headers contain have the required bits of information in a cryptic way. I'd pull the other end of the rope. If the information from config.h is needed, we can just install config.h along with the public headers. Of course, we have to use a different name for it, like gnutls-config.h, and we probably don't want to install the whole config.h, but just part of it. There are several ways how to get the subset of config.h: 1) create a make rule which would generate the subset from config.h 2) Both headers would be generated by configure, the template for the subset would be maintained manually. Look at http://cvs.gnome.org/viewcvs/goffice/ to see this in work. 3) Both the subset and the main config.h would be generated by autoheader. First, autoheader would have to be enhanced, according to this proposal http://lists.gnu.org/archive/html/autoconf/2005-05/msg00054.html Then, you'd give gnutls-config.h as the fourth parameter to the AC_DEFINEs which should go there. And then you'd probably need AH_BOTTOM([#include gnutls-config.h]) to include the subset into the main config.h. I'd prefer the last solution, but it requires a non-existent feature of autoconf 2.59. :-) Then we get back to gnulib: how could gnulib-tool easily hook into this? With solution 3): The gnulib m4 files would contain calls like this: AC_DEFINE([PUBLIC_SYMBOL], 1, [A description]m4_ifdef([gl_FEATURE_HEADER], [, gl_FEATURE_HEADER])) As soon as would the user define macro gl_FEATURE_HEADER, the public symbols would go to a separate file. But does this work? How can gnulib maintainers know which defines are needed by your public headers? The maintainer of the project has to define the subset for gnutls-config.h. So actually, it might be better to use the solution 2), with manually defined subset of config.h. But since the AC_DEFINE calls are not under your direct control, they are brought by some third party macros, there is a danger that some AC_DEFINE will disappear from configure and you won't notice it. So, after all, it seems that in your case the most robust solution might be 1). The script would not only select the #undef lines and accompanying comments, it would also check that all expected symbols were actually seen. So if an expected symbol disappered from config.h.in, the script would cry. End of my tale. Is it useful for you? Stepan ___ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib
Re: ssize_t
dnl Copyright (C) 2001-2003 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. What do we call this? How about unlimited? BTW, rms gave me different wording once for a similar notice, called all-permissive in the License Notices node of maintain.texi: Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. As Bruno and others have pointed out, the juxtaposition of the clauses is less than ideal, but rms was uninterested in changing it. Whatever ... ___ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib