コード例 #1
0
/* Test __attribute__ ((deprecated("message"))) */
/* { dg-do compile } */
/* { dg-options "-Wdeprecated-declarations -fmessage-length=0" } */

typedef int INT1 __attribute__((deprecated("Please avoid INT1")));
typedef INT1 INT2 __attribute__ ((__deprecated__("Please avoid INT2")));

typedef INT1 INT1a; 			/* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */

INT1 should_be_unavailable; 		/* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */
INT1a should_not_be_deprecated;

INT1 f1(void) __attribute__ ((deprecated("Please avoid f1"))); 
INT1 f2(void) { return 0; }		/* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */

INT2 f3(void) __attribute__ ((__deprecated__("Please avoid f3"))); 
INT2 f4(void) { return 0; }		/* { dg-warning "'INT2' is deprecated .declared at \[^\n\]*: Please avoid INT2" "" } */
int f5(INT2 x);				/* { dg-warning "'INT2' is deprecated" "" } */
int f6(INT2 x) __attribute__ ((__deprecated__("Please avoid f6")));

typedef enum Color {red, green, blue} Color __attribute__((deprecated("Please avoid Color")));

int g1;
int g2 __attribute__ ((deprecated("Please avoid g2")));
int g3 __attribute__ ((__deprecated__("Please avoid g3")));
Color k;				/* { dg-warning "'Color' is deprecated .declared at \[^\n\]*: Please avoid Color" "" } */

typedef struct {
  int field1;
  int field2 __attribute__ ((deprecated("Please avoid field2")));
  int field3;
コード例 #2
0
// RUN: %clang_cc1 %s -verify -fsyntax-only
// rdar: // 6734520

typedef int INT1 __attribute__((deprecated("Please avoid INT1")));

typedef INT1 INT2 __attribute__ ((__deprecated__("Please avoid INT2")));

typedef INT1 INT1a; // expected-warning {{'INT1' is deprecated: Please avoid INT1}}

typedef INT1 INT1b __attribute__ ((deprecated("Please avoid INT1b")));

INT1 should_be_unavailable; // expected-warning {{'INT1' is deprecated: Please avoid INT1}}
INT1a should_not_be_deprecated;

INT1 f1(void) __attribute__ ((deprecated("Please avoid f1")));
INT1 f2(void); // expected-warning {{'INT1' is deprecated: Please avoid INT1}}

typedef enum {red, green, blue} Color __attribute__((deprecated("Please avoid Color")));


Color c1; // expected-warning {{'Color' is deprecated: Please avoid Color}}

int g1;
int g2 __attribute__ ((deprecated("Please avoid g2"))); // expected-note {{'g2' declared here}}

int func1()
{
    int (*pf)() = f1; // expected-warning {{'f1' is deprecated: Please avoid f1}}
    int i = f2();
    return g1 + g2; // expected-warning {{'g2' is deprecated: Please avoid g2}}
}
コード例 #3
0
ファイル: deprecated-10.C プロジェクト: 0day-ci/gcc
// PR c++/65687

typedef struct old_visible_stuff *opaquePointer;

struct old_visible_stuff {
  int things_we_no_longer;
  int wish_to_expose;
} __attribute__((__deprecated__("do not refer to this, the layout might change")));

typedef struct old_visible_stuff *another; // { dg-warning "deprecated" }

opaquePointer runtime_function (opaquePointer someObject);

opaquePointer bad_runtime_call (struct old_visible_stuff *otherObject); // { dg-warning "deprecated" }
コード例 #4
0
/* Test __attribute__ ((deprecated("message"))) */
/* { dg-do compile } */
/* { dg-options "-Wdeprecated-declarations" } */

typedef int INT1 __attribute__((deprecated("Please avoid INT1")));
typedef INT1 INT2 __attribute__ ((__deprecated__("Please avoid INT2")));

typedef INT1 INT1a; 			/* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
typedef INT1 INT1b __attribute__ ((deprecated("Please avoid INT1b")));

INT1 should_be_unavailable; 		/* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
INT1a should_not_be_deprecated;

INT1 f1(void) __attribute__ ((deprecated("Please avoid f1"))); 
INT1 f2(void) { return 0; }		/* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */

INT2 f3(void) __attribute__ ((__deprecated__("Please avoid f3"))); 
INT2 f4(void) { return 0; }		/* { dg-warning "'INT2' is deprecated: Please avoid INT2" "" } */
int f5(INT2 x);				/* { dg-warning "'INT2' is deprecated: Please avoid INT2" "" } */
int f6(INT2 x) __attribute__ ((__deprecated__("Please avoid f6"))); /* { dg-warning "'INT2' is deprecated: Please avoid INT2" "" } */

typedef enum {red, green, blue} Color __attribute__((deprecated("Please avoid Color")));

int g1;
int g2 __attribute__ ((deprecated("Please avoid g2")));
int g3 __attribute__ ((__deprecated__("Please avoid g3")));
Color k;				/* { dg-warning "'Color' is deprecated .declared at \[^\n\]*: Please avoid Color" "" } */

typedef struct {
  int field1;
  int field2 __attribute__ ((deprecated("Please avoid field2")));