Re: [Python-Dev] C99

2016-08-06 Thread Matthias Klose
On 06.08.2016 00:27, Brett Cannon wrote:
> On Fri, 5 Aug 2016 at 15:17 Guido van Rossum  wrote:
> 
>> I want it to list specific versions that are known to be good right
>> now, so we can point fingers appropriately when a regression happens.
>>
> 
> OK, then we could pin it to MSVC 2016, gcc 6.1, and clang 3.8.1 which are
> the latest releases (unless I'm missing a compiler we all feel like we
> should officially support).

please make that GCC 6.2 once released later this month (6.1 is the first 6.x
release).

GCC 5 and GCC 6 default to C11 (-std=gnu11), does the restriction to C99 mean
that -std=gnu99 should be passed explicitly?

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Sturla Molden
Matthias Klose  wrote:

> GCC 5 and GCC 6 default to C11 (-std=gnu11), does the restriction to C99 mean
> that -std=gnu99 should be passed explicitly?

Also note that -std=c99 is not the same as -std=gnu99. The latter allows
GNU extensions like computed goto. Does the interpreter depend on those?
(Presumably it could be a benefit.)

Sturla

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Stephen J. Turnbull
Ned Deily writes:

 > I don't think OS X support should be a gating factor in deciding to
 > move ahead with C99 adoption but it does point out that there might
 > be more ramifications to this decision.

I may be talking through my hat here, but Apple has been using LLVM
for several major releases now.  They seem to be keeping the GCC
frontend stuck at 4.2.1, though.  So just because we've been using GCC
4.2.1 on Mac, including on buildbots, doesn't mean that there is no
C99 compiler available on Macs -- it's quite possible that the
available clang frontend does already support the C99 features we
would use.  I suppose that might mean fiddling with the installer
build process as well as the buildbots.

Also, it seems like it's been a decade since a C compiler came
standard with Mac OS X -- you need to download and install Xcode or
at least xcodebuildtools separately.  So unless the Macs are quite
ancient (fvo ancient = 5 years old), at least at one time they were
upgradeable by installing Xcode.

Of course Mac users may not be willing or able to upgrade Xcode, but
at least the possibility is worth investigating.

 > What may be more difficult is to judge the impact on other
 > platforms that don't get as much attention from most of us.  For
 > this to move forward, we need to be able to state what the impact
 > to current users will be.

We could post a poll to python-list (to be hosted on surveymonkey or
similar, *not* back to this list!), explaining the proposal and asking
"what is your platform?", "what compiler and version do you use?",
"does it support C99 (perhaps with switches)?", "if not, can you
upgrade to one with C99 support?", and "if you can upgrade, how much
pain would it be to upgrade?"

I guess the last one would take values from "I'd be annoyed for less
than 10 minutes then forget it" to "enough so that I wouldn't upgrade
Python".  I suppose one intermediate answer might be "I'd have to
maintain a separate compiler just for Python."

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Ned Deily
On Aug 6, 2016, at 01:16, Stephen J. Turnbull 
 wrote:
> I may be talking through my hat here, but Apple has been using LLVM
> for several major releases now.  They seem to be keeping the GCC
> frontend stuck at 4.2.1, though.  So just because we've been using GCC
> 4.2.1 on Mac, including on buildbots, doesn't mean that there is no
> C99 compiler available on Macs -- it's quite possible that the
> available clang frontend does already support the C99 features we
> would use.  I suppose that might mean fiddling with the installer
> build process as well as the buildbots.

Sorry, I wasn't clear; I did not mean to imply there is no C99 compiler 
available from Apple for OS X.  On current OS X releases, clang is the default 
and only supported compiler.  I was bringing up the example of the impact on 
building on older releases with the supported build tools for those releases 
where clang is either not available or was too immature to be usable.  As I 
said, there are a number of solutions to that problem - building on newer 
systems with deployment targets, installing third-party compilers, etc.

But the point I was trying to make is that, by changing the language 
requirement, we will likely have an effect on what platforms (across the board) 
and versions we support and we should take that into account when making this 
decision.  It may be the right decision, in balance, to drop support for some 
of these but we shouldn't do it by accident.

--
  Ned Deily
  [email protected] -- []

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Ned Deily
On Aug 6, 2016, at 00:04, Guido van Rossum  wrote:
> Different question. What features are we actually talking about? Is it
> possible to enumerate them?
> 
> The only thing I'm aware of is declarations following non-declarations
> in the same block, but I'm no C expert any more.

I'm certainly not, either.  Looking back over the original thread, there were a 
number of features talked about.  I think Larry's list here captures most of 
them:

"Clearly it'll be 3.5+ only, and clearly it'll be a specific list of 
features ("C89 but also permitting //-comments, variadic macros, 
variable declarations on any line, inline functions, and designated 
initializers").  But I'm looking forward to it!"

https://mail.python.org/pipermail/python-dev/2016-June/144831.html

So, if that set of features seems reasonable, perhaps the next step is for 
someone (not me) to put together a test patch that incorporates the use of them 
and then we can run it against the buildbots, either by using the special build 
buildbots or just temporarily checking the patch in.  I'm willing to do the 
testing and results-gathering if a patch is supplied.

--
  Ned Deily
  [email protected] -- []

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Brett Cannon
On Sat, 6 Aug 2016 at 10:16 Ned Deily  wrote:

> On Aug 6, 2016, at 00:04, Guido van Rossum  wrote:
> > Different question. What features are we actually talking about? Is it
> > possible to enumerate them?
> >
> > The only thing I'm aware of is declarations following non-declarations
> > in the same block, but I'm no C expert any more.
>
> I'm certainly not, either.  Looking back over the original thread, there
> were a number of features talked about.  I think Larry's list here captures
> most of them:
>
> "Clearly it'll be 3.5+ only, and clearly it'll be a specific list of
> features ("C89 but also permitting //-comments, variadic macros,
> variable declarations on any line, inline functions, and designated
> initializers").  But I'm looking forward to it!"
>
> https://mail.python.org/pipermail/python-dev/2016-June/144831.html
>
> So, if that set of features seems reasonable, perhaps the next step is for
> someone (not me) to put together a test patch that incorporates the use of
> them and then we can run it against the buildbots, either by using the
> special build buildbots or just temporarily checking the patch in.  I'm
> willing to do the testing and results-gathering if a patch is supplied.
>

If you want to take that route then you could try temporarily patching one
of the xx* modules as an example.
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Sturla Molden
Ned Deily  wrote:

> On Aug 6, 2016, at 01:16, Stephen J. Turnbull 
>  wrote:
>> I may be talking through my hat here, but Apple has been using LLVM
>> for several major releases now.  They seem to be keeping the GCC
>> frontend stuck at 4.2.1, though.  So just because we've been using GCC
>> 4.2.1 on Mac, including on buildbots, doesn't mean that there is no
>> C99 compiler available on Macs -- it's quite possible that the
>> available clang frontend does already support the C99 features we
>> would use.  I suppose that might mean fiddling with the installer
>> build process as well as the buildbots.
> 
> Sorry, I wasn't clear; I did not mean to imply there is no C99 compiler
> available from Apple for OS X.  On current OS X releases, clang is the
> default and only supported compiler.  I was bringing up the example of
> the impact on building on older releases with the supported build tools
> for those releases where clang is either not available or was too
> immature to be usable.  As I said, there are a number of solutions to
> that problem - building on newer systems with deployment targets,
> installing third-party compilers, etc.



Clang is also available (and installed) on OSX 10.8 and earlier, although
gcc 4.2.1 is the default frontend to LLVM. The easiest solution to get C99
on those platforms is

$ export CC=clang

Not very difficult, and highly recommended.



Sturla Molden

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Sturla Molden
"Stephen J. Turnbull"  wrote:

> I may be talking through my hat here, but Apple has been using LLVM
> for several major releases now.  They seem to be keeping the GCC
> frontend stuck at 4.2.1, though.  So just because we've been using GCC
> 4.2.1 on Mac, including on buildbots, doesn't mean that there is no
> C99 compiler available on Macs -- it's quite possible that the
> available clang frontend does already support the C99 features we
> would use.  I suppose that might mean fiddling with the installer
> build process as well as the buildbots.

On OSX 10.8 and earlier, the default CC is llvm-gcc-4.2.1, available as the
gcc command. clang is also installed, so we can always 

$ export CC=clang
$ export CXX=clang++

to remedy the problem.

On OSX 10.9 and later, gcc is just a symlink to clang.

Xcode must be installed to build anything on Mac. It is not optional. Users
who need to build Python without installing Xcode need to fix their heads.
Because that is where their problem resides. There is no remedy for
stubbornness to the level of stupidity. Either they install Xcode or they
don't get to build anything. 


Sturla

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Ned Deily
On Aug 6, 2016, at 17:55, Sturla Molden  wrote:
> On OSX 10.8 and earlier, the default CC is llvm-gcc-4.2.1, available as the
> gcc command. clang is also installed, so we can always 
[...]

Thanks, but this is getting way off-topic.  I am well aware of what compilers 
are available on what releases and how to use them.  That's not the issue under 
discussion here.

--
  Ned Deily
  [email protected] -- []

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Guido van Rossum
On Sat, Aug 6, 2016 at 2:55 PM, Sturla Molden  wrote:
> Xcode must be installed to build anything on Mac. It is not optional. Users
> who need to build Python without installing Xcode need to fix their heads.
> Because that is where their problem resides. There is no remedy for
> stubbornness to the level of stupidity. Either they install Xcode or they
> don't get to build anything.

This feels close to a code of conduct violation. This kind of language
may be okay on the Linux kernel list, but I don't see the point of it
here.

-- 
--Guido van Rossum (python.org/~guido)
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Alexander Belopolsky
On Sat, Aug 6, 2016 at 5:55 PM, Sturla Molden  wrote:
> Either they install Xcode or they
> don't get to build anything.

I always thought "Command Line Tools" would be enough.

https://developer.apple.com/library/ios/technotes/tn2339/_index.html#//apple_ref/doc/uid/DTS40014588-CH1-WHAT_IS_THE_COMMAND_LINE_TOOLS_PACKAGE_
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Sturla Molden
Guido van Rossum  wrote:

> This feels close to a code of conduct violation. This kind of language
> may be okay on the Linux kernel list, but I don't see the point of it
> here.

Sorry, I should have found a more diplomatic formulation. But the principle
remains, build problems araising from missing Xcode installation should not
be CPython's problem. It is ok to assume that Xcode is always installed
when CPython is built on OSX.

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread Hugh Fisher
> Message: 2
> Date: Sat, 6 Aug 2016 14:27:15 +0900
> From: INADA Naoki 
> To: Guido van Rossum 
> Cc: Ned Deily , Python-Dev 
> Subject: Re: [Python-Dev] C99
> Message-ID:
> 
> Content-Type: text/plain; charset=UTF-8
>
> I think these features may improve C code readability.
> (Easy feature first).
>
> * // one line comment
>
> * inline function
> static inline function can be used instead of may macros.
> It is more readable, and type safe.

My experience from a few months ago with some cross-platform code is
that clang, GCC and MSVC have different ideas about how inline
functions in C work. Are they static or extern? Do you need provide an
implementation body somewhere?

There are also differences between the C++ and C99 definitions.

Probably all solvable with build settings, but not as easy as one line comments.

-- 

cheers,
Hugh Fisher
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] C99

2016-08-06 Thread INADA Naoki
>>
>> * inline function
>> static inline function can be used instead of may macros.
>> It is more readable, and type safe.
>
> My experience from a few months ago with some cross-platform code is
> that clang, GCC and MSVC have different ideas about how inline
> functions in C work. Are they static or extern? Do you need provide an
> implementation body somewhere?

You're right. I think inline function should be used as "static inline" always.

Python uses "static inline" already, via "Py_LOCAL_INLINE" macro, when
USE_INLINE is defined. So using "static inline" is not problem.

If we can assume inline is usable, we can remove the macro, and use
"static inline"
more often to replace macros.
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com