OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [other/] [darwin-cfstring1.C] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* Test whether the __builtin__CFStringMakeConstantString
2
   "function" fails gracefully when handed a non-constant
3
   argument.  This will only work on MacOS X 10.1.2 and later.  */
4
/* Developed by Ziemowit Laski .  */
5
 
6
/* { dg-do compile { target *-*-darwin* } } */
7
/* { dg-options "-mconstant-cfstrings" } */
8
 
9
#include 
10
 
11
#ifdef __CONSTANT_CFSTRINGS__
12
#undef CFSTR
13
#define CFSTR(STR)  ((CFStringRef) __builtin___CFStringMakeConstantString (STR))
14
#endif
15
 
16
extern int cond;
17
extern const char *func(void);
18
 
19
int main(void) {
20
  CFStringRef s1 = CFSTR("Str1");
21
  CFStringRef s2 = CFSTR(cond? "Str2": "Str3"); /* { dg-error "CFString literal expression is not a string constant" } */
22
  CFStringRef s3 = CFSTR(func());  /* { dg-error "CFString literal expression is not a string constant" } */
23
 
24
  return 0;
25
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.