classification
Title: Redefinition of HAVE_STRFTIME can cause compiler errors.
Type: compile error Stage:
Components: Windows Versions: Python 2.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, braden, rgpitts
Priority: normal Keywords: patch

Created on 2009-09-02 09:39 by rgpitts, last changed 2011-07-21 07:37 by rgpitts.

Files
File name Uploaded Description Edit
issue-6820.patch rgpitts, 2011-07-21 07:36 pyconfig.h patch review
Messages (4)
msg92159 - (view) Author: rgpitts (rgpitts) Date: 2009-09-02 09:39
I'm working with the Python C API and omniOrb with Visual Studio 2008 
on Windows XP. 

A OmniOrb header corba_sys_dep.h is defining HAVE_STRFTIME as 1
...
#define HAVE_STRFTIME 1
...

pyconfig.h is then defining this again. 
...
#define HAVE_STRFTIME
...

This is raising a compiler warning and then multiple syntax errors in 
math.h depending on the order of inclusion of these headers. If the 
pyconfig.h is included after corba_sys_dep.h multiple syntax errors. 
However if it is included before only a warning is raised.

I think pyconfig.h needs changing to
#ifndef HAVE_STRFTIME
#define HAVE_STRFTIME
#endif
msg92209 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-09-03 13:07
Those HAVE_XXX symbols should be defined like autoconf does:
#define HAVE_STRFTIME 1
This is what happens on Unix platforms, and AFAIK this plays well with
other libraries which define the same symbols.
msg99337 - (view) Author: Braden McDaniel (braden) Date: 2010-02-14 07:43
In general, this does *not* play well with libraries that define the same symbols.

It is not correct to install the AC_CONFIG_HEADERS. Any macros in an installed configuration header need to be namespaced per-project; e.g., PYTHON_HAVE_STRFTIME.
msg140792 - (view) Author: rgpitts (rgpitts) Date: 2011-07-21 07:36
As Python 2.6 is now security only and 2.7 is last major release I've patched this against Python 3.2 because pyconfig.h hadn't changed much since 2.6.

I've done as Amaury suggested and changed the HAVE_XXX symbols to define 1 like autoconf. 'make patchcheck' has fixed some general formatting issues included in the patch.
History
Date User Action Args
2011-07-21 07:37:02rgpittssetfiles: + issue-6820.patch
keywords: + patch
messages: + msg140792
2010-02-14 07:43:58bradensetnosy: + braden
messages: + msg99337
2009-09-03 13:07:22amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg92209
2009-09-02 09:39:44rgpittscreate