URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
/* Test if the Objective-C @encode machinery distinguishes between
|
/* Test if the Objective-C @encode machinery distinguishes between
|
'BOOL *' (which should be encoded as a pointer to BOOL) and 'char *' (which
|
'BOOL *' (which should be encoded as a pointer to BOOL) and 'char *' (which
|
should be encoded as '*'). This is somewhat tricky wrt the NeXT runtime,
|
should be encoded as '*'). This is somewhat tricky wrt the NeXT runtime,
|
where we have 'typedef char BOOL'. */
|
where we have 'typedef char BOOL'. */
|
/* Contributed by Ziemowit Laski <zlaski@apple.com>. */
|
/* Contributed by Ziemowit Laski <zlaski@apple.com>. */
|
/* { dg-options "-fnext-runtime -lobjc" } */
|
/* { dg-options "-fnext-runtime -lobjc" } */
|
/* { dg-do run } */
|
/* { dg-do run } */
|
|
|
#include <string.h>
|
#include <string.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <objc/objc.h>
|
#include <objc/objc.h>
|
|
|
int main(void) {
|
int main(void) {
|
const char *BOOL_ptr = @encode(BOOL *);
|
const char *BOOL_ptr = @encode(BOOL *);
|
const char *BOOL_ = @encode(BOOL);
|
const char *BOOL_ = @encode(BOOL);
|
const char *char_ptr = @encode(char *);
|
const char *char_ptr = @encode(char *);
|
|
|
if(*BOOL_ptr != '^' || strcmp(BOOL_ptr + 1, BOOL_))
|
if(*BOOL_ptr != '^' || strcmp(BOOL_ptr + 1, BOOL_))
|
abort();
|
abort();
|
|
|
if(strcmp(char_ptr, "*"))
|
if(strcmp(char_ptr, "*"))
|
abort();
|
abort();
|
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.