[Python-checkins] r86362 - in python/branches/py3k-cdecimal: Lib/test/mpdecimal/Makefile.in Lib/test/mpdecimal/Makefile.vc Lib/test/mpdecimal/configure Lib/test/mpdecimal/configure.in Lib/test/mpdecimal/tests/cov.c Modules/cdecimal/error.c Modules/cdecimal/mpdecimal32.h Modules/cdecimal/mpdecimal64.h setup.py
stefan.krah
python-checkins at python.org
Tue Nov 9 19:00:24 CET 2010
Author: stefan.krah
Date: Tue Nov 9 19:00:24 2010
New Revision: 86362
Log:
Make error macros C99 compatible. Note that every major compiler
that I tried has no problem with __VA_ARGS__.
Removed:
python/branches/py3k-cdecimal/Modules/cdecimal/error.c
Modified:
python/branches/py3k-cdecimal/Lib/test/mpdecimal/Makefile.in
python/branches/py3k-cdecimal/Lib/test/mpdecimal/Makefile.vc
python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure
python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure.in
python/branches/py3k-cdecimal/Lib/test/mpdecimal/tests/cov.c
python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal32.h
python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal64.h
python/branches/py3k-cdecimal/setup.py
Modified: python/branches/py3k-cdecimal/Lib/test/mpdecimal/Makefile.in
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/mpdecimal/Makefile.in (original)
+++ python/branches/py3k-cdecimal/Lib/test/mpdecimal/Makefile.in Tue Nov 9 19:00:24 2010
@@ -88,8 +88,8 @@
OBJS := basearith.o context.o constants.o convolute.o crt.o mpdecimal.o \
- mpsignal.o difradix2.o error.o fnt.o fourstep.o io.o memory.o \
- numbertheory.o sixstep.o transpose.o
+ mpsignal.o difradix2.o fnt.o fourstep.o io.o memory.o numbertheory.o \
+ sixstep.o transpose.o
$(LIBSTATIC): Makefile vars.mk $(OBJS)
$(AR) rc $(LIBSTATIC) $(OBJS)
@@ -135,10 +135,6 @@
umodarith.h typearith.h difradix2.h vccompat.h
$(CC) $(INC) $(CFLAGS) -c difradix2.c
-error.o:\
-Makefile vars.mk error.c mpdecimal.h
- $(CC) $(INC) $(CFLAGS) -c error.c
-
fnt.o:\
Makefile vars.mk fnt.c bits.h mpdecimal.h difradix2.h numbertheory.h \
constants.h fnt.h vccompat.h
Modified: python/branches/py3k-cdecimal/Lib/test/mpdecimal/Makefile.vc
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/mpdecimal/Makefile.vc (original)
+++ python/branches/py3k-cdecimal/Lib/test/mpdecimal/Makefile.vc Tue Nov 9 19:00:24 2010
@@ -11,9 +11,8 @@
OBJS = basearith.obj context.obj constants.obj convolute.obj crt.obj \
- mpdecimal.obj mpsignal.obj difradix2.obj error.obj fnt.obj \
- fourstep.obj io.obj memory.obj numbertheory.obj sixstep.obj \
- transpose.obj
+ mpdecimal.obj mpsignal.obj difradix2.obj fnt.obj fourstep.obj \
+ io.obj memory.obj numbertheory.obj sixstep.obj transpose.obj
MPD_PREC = 9
@@ -117,10 +116,6 @@
umodarith.h typearith.h difradix2.h vccompat.h
$(CC) $(BFLAGS) $(CFLAGS) $(PFLAGS) -c difradix2.c
-error.obj:\
-Makefile error.c mpdecimal.h
- $(CC) $(BFLAGS) $(CFLAGS) $(PFLAGS) -c error.c
-
fnt.obj:\
Makefile fnt.c bits.h mpdecimal.h difradix2.h numbertheory.h constants.h \
fnt.h vccompat.h
Modified: python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure (original)
+++ python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure Tue Nov 9 19:00:24 2010
@@ -3914,7 +3914,7 @@
MPD_OPT="-O2 -fpic"
;;
suncc)
- MPD_WARN="-erroff=E_ARGUEMENT_MISMATCH"
+ MPD_WARN=
MPD_OPT="-O2 -fpic -s"
;;
esac
Modified: python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure.in
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure.in (original)
+++ python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure.in Tue Nov 9 19:00:24 2010
@@ -146,7 +146,7 @@
MPD_OPT="-O2 -fpic"
;;
suncc)
- MPD_WARN="-erroff=E_ARGUEMENT_MISMATCH"
+ MPD_WARN=
MPD_OPT="-O2 -fpic -s"
;;
esac
Modified: python/branches/py3k-cdecimal/Lib/test/mpdecimal/tests/cov.c
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/mpdecimal/tests/cov.c (original)
+++ python/branches/py3k-cdecimal/Lib/test/mpdecimal/tests/cov.c Tue Nov 9 19:00:24 2010
@@ -1336,12 +1336,10 @@
test_set_string();
test_output();
- /* Test this, too */
- mpd_err_doit(MPD_ERR_WARN, "%s", "\ncov: PASS\n");
-
/* Valgrind */
mpd_del(&mpd_ln10);
+ fprintf(stderr, "\ncov: PASS\n");
return 0;
}
Deleted: python/branches/py3k-cdecimal/Modules/cdecimal/error.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/cdecimal/error.c Tue Nov 9 19:00:24 2010
+++ (empty file)
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2008-2010 Stefan Krah. All Rights Reserved.
- * Licensed to PSF under a Contributor Agreement.
- */
-
-
-#include "mpdecimal.h"
-#include <stdio.h>
-#include <stdarg.h>
-
-
-void mpd_err_doit(int action, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- fputc('\n', stderr);
- va_end(ap);
-
- if (action == MPD_ERR_EXIT) {
- exit(EXIT_FAILURE); /* GCOV_NOT_REACHED */
- }
-}
-
Modified: python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal32.h
==============================================================================
--- python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal32.h (original)
+++ python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal32.h Tue Nov 9 19:00:24 2010
@@ -572,13 +572,12 @@
/* Error Macros */
/******************************************************************************/
-enum {MPD_ERR_EXIT, MPD_ERR_WARN};
-#define mpd_err_fatal(format, ...) \
- mpd_err_doit(MPD_ERR_EXIT, "%s:%d: error: " format, __FILE__, __LINE__, ##__VA_ARGS__)
-#define mpd_err_warn(format, ...) \
- mpd_err_doit(MPD_ERR_WARN, "%s:%d: warning: " format, __FILE__, __LINE__, ##__VA_ARGS__)
-
-void mpd_err_doit(int action, const char *fmt, ...);
+#define mpd_err_fatal(...) \
+ do {mpd_varerr("%s:%d: error: ", __VA_ARGS__, ""); exit(1);} while (0)
+#define mpd_err_warn(...) \
+ mpd_varerr("%s:%d: warning: ", __VA_ARGS__, "")
+#define mpd_varerr(intro, format, ...) \
+ fprintf(stderr, intro format "%s\n", __FILE__, __LINE__, __VA_ARGS__)
/******************************************************************************/
Modified: python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal64.h
==============================================================================
--- python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal64.h (original)
+++ python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal64.h Tue Nov 9 19:00:24 2010
@@ -587,13 +587,12 @@
/* Error Macros */
/******************************************************************************/
-enum {MPD_ERR_EXIT, MPD_ERR_WARN};
-#define mpd_err_fatal(format, ...) \
- mpd_err_doit(MPD_ERR_EXIT, "%s:%d: error: " format, __FILE__, __LINE__, ##__VA_ARGS__)
-#define mpd_err_warn(format, ...) \
- mpd_err_doit(MPD_ERR_WARN, "%s:%d: warning: " format, __FILE__, __LINE__, ##__VA_ARGS__)
-
-void mpd_err_doit(int action, const char *fmt, ...);
+#define mpd_err_fatal(...) \
+ do {mpd_varerr("%s:%d: error: ", __VA_ARGS__, ""); exit(1);} while (0)
+#define mpd_err_warn(...) \
+ mpd_varerr("%s:%d: warning: ", __VA_ARGS__, "")
+#define mpd_varerr(intro, format, ...) \
+ fprintf(stderr, intro format "%s\n", __FILE__, __LINE__, __VA_ARGS__)
/******************************************************************************/
Modified: python/branches/py3k-cdecimal/setup.py
==============================================================================
--- python/branches/py3k-cdecimal/setup.py (original)
+++ python/branches/py3k-cdecimal/setup.py Tue Nov 9 19:00:24 2010
@@ -1745,7 +1745,6 @@
'cdecimal/convolute.c',
'cdecimal/crt.c',
'cdecimal/difradix2.c',
- 'cdecimal/error.c',
'cdecimal/fnt.c',
'cdecimal/fourstep.c',
'cdecimal/io.c',
@@ -1804,8 +1803,6 @@
# Faster version without thread local contexts:
if not sysconfig.get_config_var('WITH_THREAD'):
define_macros.append(('WITHOUT_THREADS', 1))
- if 'sunos' in platform and cc == 'cc': # suncc
- extra_compile_args.extend(['-erroff=E_ARGUEMENT_MISMATCH']) # [sic]
ext = Extension (
'cdecimal',
define_macros=define_macros,
More information about the Python-checkins
mailing list