New submission from Pablo Galindo Salgado <pablog...@gmail.com>:

Programs/_testembed.c is compiled with $(MAINCC) in Makefile.pre.in and that 
will use the C++ compiler if --with-cxx-main is used in the configuration step. 
The problem is that if the C++ compiler used is some of the more uncommon ones 
(like the solaris compiler) some parts of _testembed.c and its includes fail to 
compile because they are assuming C99 or compiler extension. There are mainly 
two:

1) _testembed.c has gotos that crosses variable definitions. The C++ standard 
says:

If transfer of control enters the scope of any automatic variables (e.g. by 
jumping forward over a declaration statement), the program is ill-formed 
(cannot be compiled), unless all variables whose scope is entered have

1) scalar types declared without initializers
2) class types with trivial default constructors and trivial destructors 
declared without initializers
3) cv-qualified versions of one of the above
4) arrays of one of the above

So the gotos that can be found in `dump_config_impl` in `_testembed.c` are 
invalidating this rule.

2) `testembed.c` is pulling `pystate.h` and that header file defines a macro 
(_PyCoreConfig_INIT) that uses designated initializers that are not available 
as an extension in all C++ compilers.

The solutions that I can immediately think of aare:

1) Compile _testembed.c with the $(CC) instead of $(CCMAIN).
2) Change these files to make them compliant with the standard (by initializing 
all variables at the beginning and by using just compound literals).

----------
components: Interpreter Core
messages: 334942
nosy: pablogsal
priority: normal
severity: normal
status: open
title: _testembed.c fails to compile when using --with-cxx-main in the 
configure step
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35912>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to