bugGNUstep - Bugs: bug #34602, compiling NSRegularExpression.m...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #34602: compiling NSRegularExpression.m using clang, it emits a warning that it doesn't support blocks

Submitted by:  Sebastian Reitenbach <buzzdee>
Submitted on:  Wed 19 Oct 2011 05:37:07 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: InstallationStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: In Test

(Jump to the original submission Jump to the original submission)

Thu 20 Oct 2011 11:37:52 AM UTC, comment #6:

Hi,

when just installing gnustep-base, I still get the warning when compiling NSRegularExpression.m:

clang NSRegularExpression.m -c \
-MMD -MP -I/usr/local/include -DGNUSTEP_TARGET_DIR=\".\" -DGNUSTEP_TARGET_CPU=\"ix86\" -DGNUSTEP_TARGET_OS=\"openbsd5.0\" -DGNUSTEP_IS_FLATTENED=\"yes\" -DLIBRARY_COMBO=\"gnu-gnu-gnu\" -DGNUSTEP_BASE_INTERNAL=1 -Wall -Wdeclaration-after-
statement -Wcast-align -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fPIC -DDEBUG -fno-omit-frame-pointer -Wall -DGSWARN -DGSDIAGNOSE
-Wno-import -O2 -pipe -g -O0 -fgnu-runtime -fgnu-runtime -fconstant-string-class=NSConstantString -I../Headers -I./. -I. -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/lo
cal/include -I/usr/local/include -pthread -I/gnustep-base-1.23.1_writes_to_HOME/GNUstep/Library/Headers -I/usr/local/include \
-o obj/libgnustep-base.obj/NSRegularExpression.m.o
NSRegularExpression.m:372:3: warning: #warning Your compiler does not support blocks. NSRegularExpression will deviate from the documented behaviour when subclassing and any code that subclasses NSRegularExpression may break in unexpected way
s. It is strongly recommended that you use a compiler with blocks support. [-W#warnings]
# warning Your compiler does not support blocks. NSRegularExpression will deviate from the documented behaviour when subclassing and any code that subclasses NSRegularExpression may break in unexpected ways. It is strongly recommended
that you use a compiler with blocks support.
^
NSRegularExpression.m:374:4: warning: #warning Your compiler would support blocks if you added -fblocks to your OBJCFLAGS [-W#warnings]
# warning Your compiler would support blocks if you added -fblocks to your OBJCFLAGS
^
2 warnings generated.

but when I add -fblocks, then the file compiles without warning.

Who should put this parameter? is gnustep-make suposed to detect that the compiler understands those blocks, or does gnustep-base needs to provide that?

Sebastian

Sebastian Reitenbach <buzzdee>
Project Member
Thu 20 Oct 2011 10:37:18 AM UTC, comment #5:

Thanks ... I tried changing our workaround to define __block again after including the headers. can't help seeing it as a horrible kludge though.

Richard Frith-Macdonald <CaS>
Project Member
Thu 20 Oct 2011 10:37:02 AM UTC, comment #4:

http://llvm.org/bugs/show_bug.cgi?id=4746

julian <julian_>
Thu 20 Oct 2011 09:40:18 AM UTC, comment #3:

__block is not a reserved word, but just a preprocessor define --

#define _block __attribute_((_blocks_(byref)))

Of course, I suppose Apple may change this in the future.

Thanks

Nicola Pero <nico>
Project Member
Thu 20 Oct 2011 09:02:56 AM UTC, comment #2:

This looks like a clang bug.
As far as I can tell ... the state of affairs is as follows.

1. glibc in one of it's headers used __block as an identifier. They chose that because by convention the underscore prefix is reserved for the system (stuff like libc, other core system headers, the compiler etc) and it wasn't in use by any other software, but while legitimate, they could have made better choices.

2. then Apple chose __block as a type qualifier for their addition of blocks to the programming language ... I guess they didn't check to see if it was already in use (or only checked about OSX). I hate the use of underscores here as it's totally inconsistent with other type qualifiers in C/ObjC, but we're probably stuck with it.

3. we try to work around the conflict by redefining the __block in the preprocessor before including the system headers and undefining that again afterwards. But then find that clang has defined __block, so we have to undefine it, redefine it, and then undefine it again.

Thus far I'm sure of the facts ... the next is inference:

4. Now it looks like clang doesn't support __block as a proper qualifier/reserved word, so our workaround has trashed clang's preprocessor definition, and clang then doesn't know how to deal with __block when it appears in the code used as a type qualifier.

I'd guess we could do some sort of test to see what clang defines __block to be, and redefine it to that in gnustep-base after having included the system headers ... but that sounds like a very fragile hack ... probably it would be betterto see if the clang developers can fix things somehow.

Richard Frith-Macdonald <CaS>
Project Member
Wed 19 Oct 2011 07:30:25 PM UTC, comment #1:

i am also using clang from one week ago and am not seeing this:

-o obj/libgnustep-base.obj/NSRange.m.o
clang NSRegularExpression.m -c \
-MMD -MP -DGNUSTEP_TARGET_DIR=\".\" -DGNUSTEP_TARGET_CPU=\"ix86\" -DGNUSTEP_TARGET_OS=\"linux-gnu\" -DGNUSTEP_IS_FLATTENED=\"yes\" -DLIBRARY_COMBO=\"gnu-gnu-gnu\" -DGNUSTEP_BASE_INTERNAL=1 -Wall -Wdeclaration-after-statement -Wcast-align -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -pthread -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fgnu-runtime -fgnu-runtime -fconstant-string-class=NSConstantString -I../Headers -I./. -I. -I/home/notroot/standalone/include -I/home/notroot/standalone/include -I/home/notroot/standalone/include -I/home/notroot/standalone/include -I/home/notroot/Desktop/inst/include/ -I/home/notroot/Desktop/inst/include/libxml2 -I/home/notroot/GNUstep/Library/Headers -I/home/notroot/standalone/include \
-o obj/libgnustep-base.obj/NSRegularExpression.m.o
clang NSRunLoop.m -c \

julian <julian_>
Wed 19 Oct 2011 05:37:07 PM UTC, original submission:

clang NSRegularExpression.m -c \
-MMD -MP -I/usr/local/include -DGNUSTEP_TARGET_DIR=\".\" -DGNUSTEP_TARGET_CPU=\"ix86\" -DGNUSTEP_TARGET_OS=\"openbsd5.0\" -DGNUSTEP_IS_FLATTENED=\"yes\" -DLIBRARY_COMBO=\"gnu-gnu-gnu\" -DGNUSTEP_BASE_INTERNAL=1 -Wall
-Wdeclaration-after-statement -Wcast-align -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fPIC -DDEBUG -fno-omit-fr
ame-pointer -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -O2 -pipe -g -O0 -fgnu-runtime -fgnu-runtime -fconstant-string-class=NSConstantString -I../Headers -I./. -I. -I/usr/local/include -I/usr/local/include -I/usr/local/include
-I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include -pthread -I/gnustep-base-1.23.1_writes_to_HOME/GNUstep/Library/Headers -I/usr/local/include \
-o obj/libgnustep-base.obj/NSRegularExpression.m.o
NSRegularExpression.m:372:3: warning: #warning Your compiler does not support blocks. NSRegularExpression will deviate from the documented behaviour when subclassing and any code that subclasses NSRegularExpression may bre
ak in unexpected ways. It is strongly recommended that you use a compiler with blocks support. [-W#warnings]
# warning Your compiler does not support blocks. NSRegularExpression will deviate from the documented behaviour when subclassing and any code that subclasses NSRegularExpression may break in unexpected ways. It is s
trongly recommended that you use a compiler with blocks support.
^
NSRegularExpression.m:374:4: warning: #warning Your compiler would support blocks if you added -fblocks to your OBJCFLAGS [-W#warnings]
# warning Your compiler would support blocks if you added -fblocks to your OBJCFLAGS
^
2 warnings generated.

but when I add -fblocks to the clang command, then the following errors shows up:

clang NSRegularExpression.m -c \
-MMD -MP -I/usr/local/include -DGNUSTEP_TARGET_DIR=\".\" -DGNUSTEP_TARGET_CPU=\"ix86\" -DGNUSTEP_TARGET_OS=\"openbsd5.0\" -DGNUSTEP_IS_FLATTENED=\"yes\" -DLIBRARY_COMBO=\"gnu-gnu-gnu\" -DGNUSTEP_BASE_INTERNAL=1 -Wall -Wdeclaration-after-statement -Wcast-align -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fPIC -DDEBUG -fno-omit-frame-pointer -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -O2 -pipe -g -O0 -fgnu-runtime -fgnu-runtime -fconstant-string-class=NSConstantString -I../Headers -I./. -I. -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include -pthread -I/gnustep-base-1.23.1_writes_to_HOME/GNUstep/Library/Headers -I/usr/local/include \
-o obj/libgnustep-base.obj/NSRegularExpression.m.o -fblocks

NSRegularExpression.m:289:3: error: use of undeclared identifier '__block'
__block NSUInteger count = 0;
^
NSRegularExpression.m:297:7: error: use of undeclared identifier 'count'
count++;
^
NSRegularExpression.m:303:10: error: use of undeclared identifier 'count'
return count;
^
NSRegularExpression.m:310:3: error: use of undeclared identifier '__block'
__block NSTextCheckingResult *r = nil;
^
NSRegularExpression.m:318:7: error: use of undeclared identifier 'r'
r = result;
^
NSRegularExpression.m:325:10: error: use of undeclared identifier 'r'
return r;
^
NSRegularExpression.m:353:3: error: use of undeclared identifier '__block'
__block NSRange r;
^
NSRegularExpression.m:361:7: error: use of undeclared identifier 'r'
r = [result range];
^
NSRegularExpression.m:368:10: error: use of undeclared identifier 'r'
return r;
^
9 errors generated.

using clang 3.0 (a version about a week or so ago from their svn)

not sure whether I should worry about this one.

Sebastian

Sebastian Reitenbach <buzzdee>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by nico (Posted a comment)
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by julian_ (Posted a comment)
  • -unavailable- added by buzzdee (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 20 Oct 2011 10:37:18 AM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>In Test

    Back to the top


    Powered by Savane 3.1-cleanup1