CFSTR and NSConstantString

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

CFSTR and NSConstantString

David Chisnall-2
Hello the list,

We'd like to be able to support CFSTR() with GNUstep emitting NSConstantString instances.  There are three ways that I can do this:

1) Make CodeGenModule::GetAddrOfConstantCFString() check if the gnu runtime is being used and call the CGObjCRuntime function to emit the string if it is.

2) Add a new builtin, __builtin___NSStringMakeConstantString(), which behaves exactly like __builtin___CFStringMakeConstantString() but emits a new ObjC constant string, rather than a new CF string (although, with the Mac runtimes, they will be the same thing anyway).

3) Add a new option, like -fcfstrings-as-nsstrings which makes CF strings into NSStrings.

My preference is on the first option, although largely because it's the least effort for me.  Does anyone have any preferences or objections?

David

-- Sent from my IBM 1620


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Any reason we disallow ui64 prefix

jahanian

Hi,

In LiteralSupport.cpp we explicitly disallow ui64 suffix in msft  
extensions (as in #define ULLONG_MAX 0xffffffffffffffffui64).
This constant is defined by visual studio's "limits.h".

- Thanks, Fariborz

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [cfe-dev] Any reason we disallow ui64 prefix

Chris Lattner

On Jan 22, 2010, at 11:40 AM, Fariborz Jahanian wrote:

>
> Hi,
>
> In LiteralSupport.cpp we explicitly disallow ui64 suffix in msft
> extensions (as in #define ULLONG_MAX 0xffffffffffffffffui64).
> This constant is defined by visual studio's "limits.h".

Where is it explicitly disallowed?

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [cfe-dev] Any reason we disallow ui64 prefix

jahanian

On Jan 22, 2010, at 11:41 AM, Chris Lattner wrote:

>
> On Jan 22, 2010, at 11:40 AM, Fariborz Jahanian wrote:
>
>>
>> Hi,
>>
>> In LiteralSupport.cpp we explicitly disallow ui64 suffix in msft
>> extensions (as in #define ULLONG_MAX 0xffffffffffffffffui64).
>> This constant is defined by visual studio's "limits.h".
>
> Where is it explicitly disallowed?

in: lib/Lex/LiteralSupport.cpp

      case 'u':
     case 'U':
       if (isFPConstant) break;  // Error for floating constant.
       if (isUnsigned) break;    // Cannot be repeated.
       isUnsigned = true;
       continue;  // Success.


...

case 'i':
       if (PP.getLangOptions().Microsoft) {
         if (isFPConstant || isUnsigned || isLong || isLongLong) break;



>
>
> -Chris

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [cfe-dev] CFSTR and NSConstantString

jahanian
In reply to this post by David Chisnall-2

On Jan 22, 2010, at 11:33 AM, David Chisnall wrote:

> Hello the list,
>
> We'd like to be able to support CFSTR() with GNUstep emitting  
> NSConstantString instances.  There are three ways that I can do this:
>
> 1) Make CodeGenModule::GetAddrOfConstantCFString() check if the gnu  
> runtime is being used and call the CGObjCRuntime function to emit  
> the string if it is.
>
> 2) Add a new builtin, __builtin___NSStringMakeConstantString(),  
> which behaves exactly like __builtin___CFStringMakeConstantString()  
> but emits a new ObjC constant string, rather than a new CF string  
> (although, with the Mac runtimes, they will be the same thing anyway).
>
> 3) Add a new option, like -fcfstrings-as-nsstrings which makes CF  
> strings into NSStrings.
>
> My preference is on the first option, although largely because it's  
> the least effort for me.  Does anyone have any preferences or  
> objections?

Since 2) has established a precedence, we should probably go with that.

- fariborz

>
>
> David
>
> -- Sent from my IBM 1620
>
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [cfe-dev] Any reason we disallow ui64 prefix

Chris Lattner
In reply to this post by jahanian

On Jan 22, 2010, at 11:47 AM, Fariborz Jahanian wrote:

>
> On Jan 22, 2010, at 11:41 AM, Chris Lattner wrote:
>
>>
>> On Jan 22, 2010, at 11:40 AM, Fariborz Jahanian wrote:
>>
>>>
>>> Hi,
>>>
>>> In LiteralSupport.cpp we explicitly disallow ui64 suffix in msft
>>> extensions (as in #define ULLONG_MAX 0xffffffffffffffffui64).
>>> This constant is defined by visual studio's "limits.h".
>>
>> Where is it explicitly disallowed?
>
> in: lib/Lex/LiteralSupport.cpp
>
>     case 'u':
>    case 'U':
>      if (isFPConstant) break;  // Error for floating constant.
>      if (isUnsigned) break;    // Cannot be repeated.
>      isUnsigned = true;
>      continue;  // Success.
>
>
> ...
>
> case 'i':
>      if (PP.getLangOptions().Microsoft) {
>        if (isFPConstant || isUnsigned || isLong || isLongLong) break;

Ah, just looks like an oversight,

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [cfe-dev] Any reason we disallow ui64 prefix

Nuno Lopes
In reply to this post by jahanian
Oh ,sorry, this looks an oversight from my part when I restructured that
code.
Nuno

> Hi,
>
> In LiteralSupport.cpp we explicitly disallow ui64 suffix in msft
> extensions (as in #define ULLONG_MAX 0xffffffffffffffffui64).
> This constant is defined by visual studio's "limits.h".
>
> - Thanks, Fariborz

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev