[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
snprintf gnulibification, first step
From: |
Daniel Jacobowitz |
Subject: |
snprintf gnulibification, first step |
Date: |
Fri, 23 Feb 2007 23:42:31 -0500 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
I checked in the attached to libsnprintfv. This is the first step in
getting it to use gnulib for its own portability needs, which will
make it easier to integrate with gnulib. Most of this is extremely
predictable. The only bits that deserve mention are:
- The modules it uses so far are: stdint string wchar wcwidth. It
doesn't have any actual need for wcwidth, but it was the smallest
module which included wchar_t.m4 and wint_t.m4. When this is in
gnulib they can either get their own module, or just be listed
directly in modules/svnprintfv.
- This builds for MinGW32 with --disable-shared. It won't with
--enable-shared, because ltdl.c will deliberately export some
symbols, which disables auto-export. The malloc / realloc / free
variables were explicitly marked as exported but nothing else was,
leading to all the tests failing to link. Whoops.
Since, once it is in gnulib, we'll be building the tests
differently anyway and removing support for a standalone
libsnprintfv.dll, I stopped messing with this after failing to get
it to work several times.
compat.in will be the next thing to go. We can take advantage of
those shiny new modules for some of it, and I'm tentatively planning
to remove various portability widgets that the rest of gnulib just
relies on now. Plus everything simplifies when we no longer need to
make it installable.
--
Daniel Jacobowitz
CodeSourcery
2007-02-23 Daniel Jacobowitz <address@hidden>
* Makefile.am (ACLOCAL_AMFLAGS): Add -I m4.
(SUBDIRS): Add lib.
* configure.ac: Remove AC_LIBTOOL_WIN32_DLL. Use AC_LIBTOOL_DLOPEN,
gl_EARLY, and gl_INIT. Generate lib/Makefile.
* doc/mem.texi: Regenerated.
* snprintfv/Makefile.am (AM_CPPFLAGS, LDADD): Update for gnulib.
* snprintfv/compat.in (SNV_SCOPE): Delete.
* snprintfv/mem.h (snv_malloc, snv_realloc, snv_free): Do not use it.
* tests/Makefile.am (AM_CPPFLAGS, LDADD): Update for gnulib.
* lib, m4: New directories for gnulib imports.
Index: Makefile.am
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/Makefile.am,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.am
--- Makefile.am 21 Feb 2007 15:41:26 -0000 1.6
+++ Makefile.am 24 Feb 2007 04:26:02 -0000
@@ -26,10 +26,10 @@
## Code:
-ACLOCAL_AMFLAGS = -I .
+ACLOCAL_AMFLAGS = -I . -I m4
AUTOMAKE_OPTIONS = gnits
-SUBDIRS = snprintfv doc tests
+SUBDIRS = lib snprintfv doc tests
DIST_SUBDIRS = $(SUBDIRS)
Index: configure.ac
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/configure.ac,v
retrieving revision 1.5
diff -u -p -r1.5 configure.ac
--- configure.ac 23 Feb 2007 13:14:11 -0000 1.5
+++ configure.ac 24 Feb 2007 04:26:02 -0000
@@ -42,7 +42,9 @@ SNV_CURRENT=3; AC_SUBST(SNV_CURRENT)
SNV_REVISION=0; AC_SUBST(SNV_REVISION)
SNV_AGE=0; AC_SUBST(SNV_AGE)
-AC_LIBTOOL_WIN32_DLL
+gl_EARLY
+
+AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AC_PROG_SED
@@ -132,6 +134,8 @@ AC_PROG_AWK
AC_LIB_LTDL
+gl_INIT
+
# ----------------------------------------------------------------------
# check for standard headers.
# ----------------------------------------------------------------------
@@ -165,7 +169,8 @@ AC_SUBST(LIBS)
AC_SUBST(INCLUDES)
AC_SUBST(ac_aux_dir)
-AC_CONFIG_FILES(Makefile snprintfv/Makefile doc/Makefile tests/Makefile)
+AC_CONFIG_FILES(Makefile snprintfv/Makefile doc/Makefile tests/Makefile
+ lib/Makefile)
AC_OUTPUT
dnl configure.ac ends here
Index: doc/mem.texi
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/doc/mem.texi,v
retrieving revision 1.2
diff -u -p -r1.2 mem.texi
--- doc/mem.texi 21 Feb 2007 15:41:26 -0000 1.2
+++ doc/mem.texi 24 Feb 2007 04:26:02 -0000
@@ -1,4 +1,4 @@
address@hidden Function SNV_SCOPE malloc_proc_t *snv_malloc; snv_malloc (, )
address@hidden Function malloc_proc_t *snv_malloc; snv_malloc (, )
@fnindex snv_malloc
Parameters:
@@ -14,7 +14,7 @@ The pointer to the newly-allocated memor
@end deftypefn
address@hidden Function SNV_SCOPE realloc_proc_t *snv_realloc; snv_realloc (, ,
)
address@hidden Function realloc_proc_t *snv_realloc; snv_realloc (, , )
@fnindex snv_realloc
Parameters:
@@ -34,7 +34,7 @@ the same as @var{old}.
@end deftypefn
address@hidden Function SNV_SCOPE free_proc_t *snv_free; snv_free (/* And these
are reimplemented tout court because they are, )
address@hidden Function free_proc_t *snv_free; snv_free (/* And these are
reimplemented tout court because they are, )
@fnindex snv_free
Parameters:
Index: snprintfv/Makefile.am
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/snprintfv/Makefile.am,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.am
--- snprintfv/Makefile.am 21 Feb 2007 15:41:26 -0000 1.6
+++ snprintfv/Makefile.am 24 Feb 2007 04:26:02 -0000
@@ -36,7 +36,9 @@ GENPROTO = $(top_srcdir)/genproto
GENPROTO_FLAGS = $(top_srcdir)/gendoc.awk
GENPROTO_ENVIRONMENT = FORMAT=SNV_GNUC_PRINTF
-AM_CPPFLAGS = -I$(top_srcdir)
+AM_CPPFLAGS = -I$(top_srcdir) -I./lib -I$(top_srcdir)/lib
+
+LDADD = $(top_builddir)/lib/libgnu.la
if INSTALL_SNPRINTFV
include_HEADERS = printf.h
Index: snprintfv/compat.in
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/snprintfv/compat.in,v
retrieving revision 1.5
diff -u -p -r1.5 compat.in
--- snprintfv/compat.in 21 Feb 2007 15:41:26 -0000 1.5
+++ snprintfv/compat.in 24 Feb 2007 04:26:02 -0000
@@ -89,19 +89,6 @@ typedef enum { SNV_FALSE = 0, SNV_TRUE =
# endif
#endif
-#ifdef _WIN32
-# ifdef DLL_EXPORT
-# define SNV_SCOPE extern __declspec(dllexport)
-# else
-# ifdef LIBSNPRINTFV_DLL_IMPORT
-# define SNV_SCOPE extern __declspec(dllimport)
-# endif
-# endif
-#endif
-#ifndef SNV_SCOPE
-# define SNV_SCOPE extern
-#endif
-
#undef SNV_GNUC_PRINTF
#undef SNV_GNUC_NORETURN
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
Index: snprintfv/mem.h
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/snprintfv/mem.h,v
retrieving revision 1.5
diff -u -p -r1.5 mem.h
--- snprintfv/mem.h 21 Feb 2007 15:41:26 -0000 1.5
+++ snprintfv/mem.h 24 Feb 2007 04:26:02 -0000
@@ -65,7 +65,7 @@ typedef void* (free_proc_t )(snv_point
* Return value:
* The pointer to the newly-allocated memory area.
*/
-SNV_SCOPE malloc_proc_t *snv_malloc;
+malloc_proc_t *snv_malloc;
/**
* snv_realloc:
@@ -79,7 +79,7 @@ SNV_SCOPE malloc_proc_t *snv_malloc;
* The pointer to the newly-allocated memory area, possibly
* the same as @old.
*/
-SNV_SCOPE realloc_proc_t *snv_realloc;
+realloc_proc_t *snv_realloc;
/**
* snv_free:
@@ -87,7 +87,7 @@ SNV_SCOPE realloc_proc_t *snv_realloc;
*
* Frees a block of memory pointed to by @old.
*/
-SNV_SCOPE free_proc_t *snv_free;
+free_proc_t *snv_free;
/* And these are reimplemented tout court because they are
not fully portable. */
Index: tests/Makefile.am
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/tests/Makefile.am,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.am
--- tests/Makefile.am 21 Feb 2007 15:41:26 -0000 1.6
+++ tests/Makefile.am 24 Feb 2007 04:26:02 -0000
@@ -33,8 +33,11 @@ MAINTAINERCLEANFILES = Makefile.in
SUFFIXES = .c .h .o .def
AM_CPPFLAGS = -I$(top_srcdir)/snprintfv -I$(top_srcdir) \
- -I$(top_builddir)/snprintfv -I$(top_builddir)
-LDADD = $(top_builddir)/snprintfv/libsnprintfv.la
+ -I$(top_builddir)/snprintfv -I$(top_builddir) \
+ -I./lib -I$(top_srcdir)/lib
+
+LDADD = $(top_builddir)/snprintfv/libsnprintfv.la \
+ $(top_builddir)/lib/libgnu.la
TESTS_ENVIRONMENT = top_builddir=$(top_builddir)
- snprintf gnulibification, first step,
Daniel Jacobowitz <=