URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
704 |
jeremybenn |
/* Test the -Wnonportable-cfstrings option, which should give
|
2 |
|
|
warnings if non-ASCII characters are embedded in constant
|
3 |
|
|
CFStrings. This will only work on MacOS X 10.2 and later. */
|
4 |
|
|
/* Developed by Ziemowit Laski <zlaski@apple.com>. */
|
5 |
|
|
|
6 |
|
|
/* So far, CFString is darwin-only. */
|
7 |
|
|
/* { dg-do compile { target *-*-darwin* } } */
|
8 |
|
|
/* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */
|
9 |
|
|
/* { dg-options "-mconstant-cfstrings -Wnonportable-cfstrings" } */
|
10 |
|
|
|
11 |
|
|
#import <Foundation/NSString.h>
|
12 |
|
|
#import <CoreFoundation/CFString.h>
|
13 |
|
|
|
14 |
|
|
#ifndef __CONSTANT_CFSTRINGS__
|
15 |
|
|
#error The -fconstant-cfstrings option is not functioning properly
|
16 |
|
|
#endif
|
17 |
|
|
|
18 |
|
|
void foo(void) {
|
19 |
|
|
NSString *s1 = @"Compile-time string literal";
|
20 |
|
|
CFStringRef s2 = CFSTR("Compile-time string literal");
|
21 |
|
|
NSString *s3 = @"Non-ASCII literal - \222"; /* { dg-warning "non-ASCII character in CFString literal" } */
|
22 |
|
|
CFStringRef s4 = CFSTR("\222 - Non-ASCII literal"); /* { dg-warning "non-ASCII character in CFString literal" } */
|
23 |
|
|
CFStringRef s5 = CFSTR("Non-ASCII (\222) literal"); /* { dg-warning "non-ASCII character in CFString literal" } */
|
24 |
|
|
NSString *s6 = @"\0Embedded NUL"; /* { dg-warning "embedded NUL in CFString literal" } */
|
25 |
|
|
CFStringRef s7 = CFSTR("Embedded \0NUL"); /* { dg-warning "embedded NUL in CFString literal" } */
|
26 |
|
|
CFStringRef s8 = CFSTR("Embedded NUL\0"); /* { dg-warning "embedded NUL in CFString literal" } */
|
27 |
|
|
}
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.