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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [objc.dg/] [encode-1.m] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* Test if the Objective-C @encode machinery distinguishes between
2
   'BOOL *' (which should be encoded as a pointer to BOOL) and 'char *' (which
3
   should be encoded as '*').  This is somewhat tricky wrt the NeXT runtime,
4
   where we have 'typedef char BOOL'.  */
5
/* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
6
/* { dg-options "-fnext-runtime -lobjc" } */
7
/* { dg-do run } */
8
 
9
#include <string.h>           
10
#include <stdlib.h>
11
#include <objc/objc.h>
12
 
13
int main(void) {
14
  const char *BOOL_ptr = @encode(BOOL *);
15
  const char *BOOL_ = @encode(BOOL);
16
  const char *char_ptr = @encode(char *);
17
 
18
  if(*BOOL_ptr != '^' || strcmp(BOOL_ptr + 1, BOOL_))
19
    abort();
20
 
21
  if(strcmp(char_ptr, "*"))
22
    abort();
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.