This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ./configure --with-stdc89 to test ANSI C conformity
Type: enhancement Stage: resolved
Components: Build Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, christian.heimes, georg.brandl, rpetrov, vstinner
Priority: normal Keywords: patch

Created on 2008-12-06 02:25 by christian.heimes, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
with_stdc89.patch christian.heimes, 2008-12-06 02:25
with_stdc89_2.patch christian.heimes, 2008-12-06 09:23
python-trunk-20081209-c89.patch rpetrov, 2008-12-08 23:46 updated c89 patch for linux
python3-20110520-c89.patch rpetrov, 2011-05-19 22:05 update review
with_stdc89_3.patch christian.heimes, 2013-06-24 14:08 review
with_stdc89_3.patch christian.heimes, 2013-06-24 14:09 review
Messages (16)
msg77097 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-12-06 02:25
The patch adds a configure option --with-stdc89. It also fixes some edge
cases in socketmodule.h and linuxaudiodev so all related modules can be
build in c89 mode.

I'm planning to add the configure option to the build bots in order to
detect c89 incompatibilities like the usage of "inline" and // style
comments.
msg77102 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-12-06 08:08
Patch looks good.
msg77106 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-12-06 09:23
The updated patch moves the compiler option to the right place.
msg77141 - (view) Author: Roumen Petrov (rpetrov) * Date: 2008-12-06 16:17
There is no reason to overload configure script.

Please look into pyport.h :
#define Py_LOCAL(type) static type
#define Py_LOCAL_INLINE(type) static inline type

Someone add USE_INLINE - not finished.
I guess that other source files has to use macros from one
header(pyport.h) instead every C-file to resolve issue independently.
msg77144 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-12-06 16:47
I think you don't get the point of the patch. The configure option
*enforces* the C89 standard. Every non C89 conform C feature like //
comments and the "inline" keyword will cause a compiler error.

The patch is meant for testing the Python code on the build bots.
msg77146 - (view) Author: Roumen Petrov (rpetrov) * Date: 2008-12-06 16:52
Christian did you like to propose a separate configure flag for every
dialect that GCC support? I prefer variables like OPT.
msg77148 - (view) Author: Roumen Petrov (rpetrov) * Date: 2008-12-06 16:53
P.S. About C++ comments ( // ) I think that another issue is already
opened (problem on AIX ? ) .
msg77149 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-12-06 16:55
Python core code must be compliant with the C89 standard but we don't
have any checks for C89 compatibility. This patch adds a clean way to
check our code base.

You can verify my patch by adding a // comment somewhere in the code and
./configure --with-stdc89 && make.
msg77156 - (view) Author: Roumen Petrov (rpetrov) * Date: 2008-12-06 18:19
make EXTRA_CFLAGS='-std=c89' works for me.
msg77240 - (view) Author: Roumen Petrov (rpetrov) * Date: 2008-12-07 18:47
:-( the last my comment is incomplete : work for me after "minimal patch"
msg77369 - (view) Author: Roumen Petrov (rpetrov) * Date: 2008-12-08 23:46
Socket module need to be patched too otherwise test_socket fail on UNIX
domain socket tests.

After clean build and with new patch the regression tests results are:
337 tests OK.
3 tests failed:
    test_curses test_urllib2_localnet test_urllibnet
21 tests skipped:
    test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl
    test_gl test_imgfile test_kqueue test_macos test_macostools
    test_pep277 test_py3kwarn test_scriptpackages test_sqlite
    test_startfile test_sunaudiodev test_unicode_file test_winreg
    test_winsound test_zipfile64
Those skips are all expected on linux2.

Interesting for failed tests is that every succeed if run independently.
msg136338 - (view) Author: Roumen Petrov (rpetrov) * Date: 2011-05-19 22:05
Issue with inline was resolved by configure macro.
msg136413 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-05-21 00:15
Is it still useful to ensure that ISO C89 compilers are supported in 2011?
msg136438 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-05-21 13:33
Yes, vs2008 requires that variables must be declared at the start of a block, and IIRC there is a AIX compiler that does not allow // comments.
msg191765 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-06-24 14:08
Updated patch for Python 3.4.

The feature is still useful. For example I found a bug in pymacro.h and fixed it in r84306.
msg191766 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-06-24 14:09
Make that r6915dfddb3f6
History
Date User Action Args
2022-04-11 14:56:42adminsetgithub: 48808
2016-09-10 21:28:25christian.heimessetstatus: open -> closed
resolution: out of date
stage: patch review -> resolved
2013-06-24 14:09:26christian.heimessetfiles: + with_stdc89_3.patch

messages: + msg191766
2013-06-24 14:08:46christian.heimessetfiles: + with_stdc89_3.patch

title: with_stdc89 -> ./configure --with-stdc89 to test ANSI C conformity
messages: + msg191765
versions: + Python 3.3, Python 3.4, - Python 3.2
2011-05-21 13:33:11amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg136438
2011-05-21 00:15:04vstinnersetnosy: + vstinner
messages: + msg136413
2011-05-19 22:05:50rpetrovsetfiles: + python3-20110520-c89.patch

messages: + msg136338
2010-08-03 21:26:37terry.reedylinkissue6558 superseder
2010-07-10 06:11:33terry.reedysetkeywords: patch, patch
versions: + Python 3.2, - Python 2.6, Python 3.0, Python 3.1, Python 2.7
2008-12-08 23:46:24rpetrovsetfiles: - python-trunk-20081206-c89.patch
2008-12-08 23:46:16rpetrovsetfiles: + python-trunk-20081209-c89.patch
messages: + msg77369
2008-12-07 18:47:00rpetrovsetmessages: + msg77240
2008-12-06 18:19:20rpetrovsetfiles: + python-trunk-20081206-c89.patch
messages: + msg77156
2008-12-06 16:55:51christian.heimessetkeywords: patch, patch
messages: + msg77149
2008-12-06 16:53:33rpetrovsetmessages: + msg77148
2008-12-06 16:52:10rpetrovsetmessages: + msg77146
2008-12-06 16:47:21christian.heimessetkeywords: patch, patch
messages: + msg77144
2008-12-06 16:17:06rpetrovsetnosy: + rpetrov
messages: + msg77141
2008-12-06 09:23:46christian.heimessetkeywords: patch, patch
files: + with_stdc89_2.patch
messages: + msg77106
2008-12-06 08:08:03georg.brandlsetkeywords: patch, patch
nosy: + georg.brandl
messages: + msg77102
2008-12-06 02:25:26christian.heimescreate