* [Bug libc/11157] __block is a reserved word with clang -fblocks
2010-01-10 17:52 [Bug libc/11157] New: __block is a reserved word with clang -fblocks truls dot becken at gmail dot com
@ 2010-01-15 7:35 ` drepper at redhat dot com
2010-01-25 21:36 ` truls dot becken at gmail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: drepper at redhat dot com @ 2010-01-15 7:35 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From drepper at redhat dot com 2010-01-15 07:34 -------
Then don't use it. It is not acceptable that compilers steal identifiers.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX
http://sourceware.org/bugzilla/show_bug.cgi?id=11157
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libc/11157] __block is a reserved word with clang -fblocks
2010-01-10 17:52 [Bug libc/11157] New: __block is a reserved word with clang -fblocks truls dot becken at gmail dot com
2010-01-15 7:35 ` [Bug libc/11157] " drepper at redhat dot com
@ 2010-01-25 21:36 ` truls dot becken at gmail dot com
2010-04-04 18:33 ` drepper at redhat dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: truls dot becken at gmail dot com @ 2010-01-25 21:36 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From truls dot becken at gmail dot com 2010-01-25 21:36 -------
This is an absolutely ridiculous attitude. The C standard (section 17.4.3.1.2) reserves identifiers that start with an
underscore for the implementation. There are two cases when it is acceptable to use them:
- As public symbols exported by libc.
- As keywords for non-standard compiler extensions.
By convention, double underscores are reserved for the compiler, single underscores for the libc. All C compilers add
extensions that begin with double underscores. GCC defines some like __asm, Microsoft's C compiler defines some for
SEH, Clang supports most of the GCC ones and __block.
Using them as parameter names in the header is entirely wrong and is not guaranteed to work on any standards-
compliant compiler. If glibc exported a __block function or global variable, then your attitude would make sense, but
you are using __block as an identifier in a context that is explicitly not supported by the standard.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|WONTFIX |
http://sourceware.org/bugzilla/show_bug.cgi?id=11157
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libc/11157] __block is a reserved word with clang -fblocks
2010-01-10 17:52 [Bug libc/11157] New: __block is a reserved word with clang -fblocks truls dot becken at gmail dot com
2010-01-15 7:35 ` [Bug libc/11157] " drepper at redhat dot com
2010-01-25 21:36 ` truls dot becken at gmail dot com
@ 2010-04-04 18:33 ` drepper at redhat dot com
2010-04-06 23:31 ` Tanktalus at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: drepper at redhat dot com @ 2010-04-04 18:33 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From drepper at redhat dot com 2010-04-04 18:32 -------
(In reply to comment #2)
> By convention, double underscores are reserved for the compiler,
This is just plain wrong.
Compilers cannot just introduce new keywords, they have to live in many
environments. Therefore they have to be extra careful and use appropriate
prefixes etc. The llvm people don't care so why should anyone else?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |WONTFIX
http://sourceware.org/bugzilla/show_bug.cgi?id=11157
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libc/11157] __block is a reserved word with clang -fblocks
2010-01-10 17:52 [Bug libc/11157] New: __block is a reserved word with clang -fblocks truls dot becken at gmail dot com
` (2 preceding siblings ...)
2010-04-04 18:33 ` drepper at redhat dot com
@ 2010-04-06 23:31 ` Tanktalus at gmail dot com
2010-06-08 7:40 ` bonzini at gnu dot org
2010-06-08 8:03 ` bonzini at gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: Tanktalus at gmail dot com @ 2010-04-06 23:31 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From Tanktalus at gmail dot com 2010-04-06 23:31 -------
http://web.archive.org/web/20040209031039/http://oakroadsystems.com/tech/c-predef.htm#ReservedIdentifiers
seems to disagree with you. The C standard also disagrees with you: anything
starting with an underscore is reserved to the compiler. The compiler is free
to create new anything that starts with an underscore.
Just googling for "reserved identifiers c" also shows
http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.vacpp7a.doc/language/ref/clrc02reserved_identifiers.htm
- IBM's compiler also says "Identifiers that begin with an underscore are
reserved as identifiers with file scope in both the ordinary and tag name
spaces." Since "__block" starts with an underscore, it's reserved for the compiler.
Googling for "reserved identifiers c gnu" shows
http://www.gnu.org/s/libc/manual/html_node/Reserved-Names.html, for the gnu C
compiler, which says "all identifiers regardless of use that begin with either
two underscores or an underscore followed by a capital letter are reserved
names. This is so that the library and header files can define functions,
variables, and macros for internal purposes without risk of conflict with names
in user programs." In other words, your use of __block is a conflict and should
be changed, just to fit with GNU C.
Basically, these are reserved specifically so that the compilers can define new
identifiers without stealing by reserving in advance everything that starts with
an underscore.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|WONTFIX |
http://sourceware.org/bugzilla/show_bug.cgi?id=11157
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libc/11157] __block is a reserved word with clang -fblocks
2010-01-10 17:52 [Bug libc/11157] New: __block is a reserved word with clang -fblocks truls dot becken at gmail dot com
` (3 preceding siblings ...)
2010-04-06 23:31 ` Tanktalus at gmail dot com
@ 2010-06-08 7:40 ` bonzini at gnu dot org
2010-06-08 8:03 ` bonzini at gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: bonzini at gnu dot org @ 2010-06-08 7:40 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From bonzini at gnu dot org 2010-06-08 07:39 -------
> By convention, double underscores are reserved for the compiler, single
underscores for the libc.
This is wrong and makes no sense. By _the standard_ double underscores are
reserved for the implementation (and the namespace is shared by the compiler and
libc; they have to live together). There are no conventions about how to share
the namespace.
> Using them as parameter names in the header is entirely wrong and is not
guaranteed to work on any standards-compliant compiler.
This is also imprecise. It is not guaranteed to work, period. Your
interpretation of the standard is that libc should not use argument names in its
header file prototypes. I kind of agree that it is safer and it would fix _this
particular case_ but in general it is not possible. It would mean no inlines
and in C++ not even templates, unless you want to "uglify" foo as __libc_foo
which is not reasonable.
GCC has a "fixincludes" utilities that adapts problematic headers. Most of the
time it fixes code that is indeed wrong according to the standard, but a few
adjustments are for conflicts with its own usage of __ identifiers. If clang
doesn't have a fixincludes utility, that's its problem.
BTW the workaround is simply to do
#define __block __glibc_block
#include <unistd.h>
#undef __block
which is all but unreasonable.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |INVALID
http://sourceware.org/bugzilla/show_bug.cgi?id=11157
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libc/11157] __block is a reserved word with clang -fblocks
2010-01-10 17:52 [Bug libc/11157] New: __block is a reserved word with clang -fblocks truls dot becken at gmail dot com
` (4 preceding siblings ...)
2010-06-08 7:40 ` bonzini at gnu dot org
@ 2010-06-08 8:03 ` bonzini at gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: bonzini at gnu dot org @ 2010-06-08 8:03 UTC (permalink / raw)
To: glibc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |bonzini at gnu dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=11157
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread