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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [type-stream-1.m] - Blame information for rev 154

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

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-options "-fgnu-runtime" } */
2
/* { dg-do run } */
3
#include <objc/typedstream.h>
4
#include <stdio.h>
5
#include <stdlib.h>
6
 
7
int main (void)
8
{
9
  FILE *f; TypedStream *ts;
10
  struct T { int a, b; } x = { 1, 2 };
11
  f = fopen ("foo", "w"); ts = objc_open_typed_stream (f, OBJC_WRITEONLY);
12
  objc_write_type (ts, @encode(struct T), &x);
13
  objc_close_typed_stream (ts); fclose (f);
14
  f = fopen ("foo", "r"); ts = objc_open_typed_stream (f, OBJC_READONLY);
15
  struct T y;
16
  objc_read_type (ts, @encode(struct T), &y);
17
  if (y.a != 1)
18
   abort ();
19
  if (y.b != 2)
20
   abort ();
21
  objc_close_typed_stream (ts); fclose (f);
22
  remove ("foo");
23
  return 0;
24
}
25
 

powered by: WebSVN 2.1.0

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