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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [va-arg-pack-len-2.c] - Diff between revs 816 and 826

Only display areas with differences | Details | Blame | View Log

Rev 816 Rev 826
/* { dg-do compile } */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-options "-O2" } */
 
 
#include <stdarg.h>
#include <stdarg.h>
 
 
extern int error_open_missing_mode (void)
extern int error_open_missing_mode (void)
  __attribute__((__error__ ("open with O_CREAT needs 3 arguments, only 2 were given")));
  __attribute__((__error__ ("open with O_CREAT needs 3 arguments, only 2 were given")));
extern int warn_open_too_many_arguments (void)
extern int warn_open_too_many_arguments (void)
  __attribute__((__warning__ ("open called with more than 3 arguments")));
  __attribute__((__warning__ ("open called with more than 3 arguments")));
 
 
extern int myopen2 (const char *path, int oflag);
extern int myopen2 (const char *path, int oflag);
extern int myopenva (const char *path, int oflag, ...);
extern int myopenva (const char *path, int oflag, ...);
 
 
extern inline __attribute__((always_inline, gnu_inline)) int
extern inline __attribute__((always_inline, gnu_inline)) int
myopen (const char *path, int oflag, ...)
myopen (const char *path, int oflag, ...)
{
{
  if (__builtin_va_arg_pack_len () > 1)
  if (__builtin_va_arg_pack_len () > 1)
    warn_open_too_many_arguments ();    /* { dg-warning "called with more than 3" } */
    warn_open_too_many_arguments ();    /* { dg-warning "called with more than 3" } */
 
 
  if (__builtin_constant_p (oflag))
  if (__builtin_constant_p (oflag))
    {
    {
      if ((oflag & 0x40) != 0 && __builtin_va_arg_pack_len () < 1)
      if ((oflag & 0x40) != 0 && __builtin_va_arg_pack_len () < 1)
        {
        {
          error_open_missing_mode ();   /* { dg-error "needs 3 arguments, only 2 were given" } */
          error_open_missing_mode ();   /* { dg-error "needs 3 arguments, only 2 were given" } */
          return myopen2 (path, oflag);
          return myopen2 (path, oflag);
        }
        }
      return myopenva (path, oflag, __builtin_va_arg_pack ());
      return myopenva (path, oflag, __builtin_va_arg_pack ());
    }
    }
 
 
  if (__builtin_va_arg_pack_len () < 1)
  if (__builtin_va_arg_pack_len () < 1)
    return myopen2 (path, oflag);
    return myopen2 (path, oflag);
 
 
  return myopenva (path, oflag, __builtin_va_arg_pack ());
  return myopenva (path, oflag, __builtin_va_arg_pack ());
}
}
 
 
int
int
main (void)
main (void)
{
{
  myopen ("h", 0x43);
  myopen ("h", 0x43);
  myopen ("i", 0x43, 0644, 0655);
  myopen ("i", 0x43, 0644, 0655);
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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