mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-21 10:42:35 +00:00

We have a new policy in place making links to private resources something we try to avoid in source and test files. Normally, we'd organically switch to the new policy rather than make a sweeping change across a project. However, Clang is in a somewhat special circumstance currently: recently, I've had several new contributors run into rdar links around test code which their patch was changing the behavior of. This turns out to be a surprisingly bad experience, especially for newer folks, for a handful of reasons: not understanding what the link is and feeling intimidated by it, wondering whether their changes are actually breaking something important to a downstream in some way, having to hunt down strangers not involved with the patch to impose on them for help, accidental pressure from asking for potentially private IP to be made public, etc. Because folks run into these links entirely by chance (through fixing bugs or working on new features), there's not really a set of problematic links to focus on -- all of the links have basically the same potential for causing these problems. As a result, this is an omnibus patch to remove all such links. This was not a mechanical change; it was done by manually searching for rdar, radar, radr, and other variants to find all the various problematic links. From there, I tried to retain or reword the surrounding comments so that we would lose as little context as possible. However, because most links were just a plain link with no supporting context, the majority of the changes are simple removals. Differential Review: https://reviews.llvm.org/D158071
97 lines
3.1 KiB
C
97 lines
3.1 KiB
C
// RUN: %clang_cc1 -pedantic -Wunused-label -Wno-deprecated-non-prototype -verify -x c %s
|
|
// RUN: cp %s %t
|
|
// RUN: not %clang_cc1 -pedantic -Wunused-label -fixit -x c %t
|
|
// RUN: %clang_cc1 -pedantic -Wunused-label -Wno-deprecated-non-prototype -Werror -x c %t
|
|
// RUN: grep -v CHECK %t | FileCheck %t
|
|
|
|
/* This is a test of the various code modification hints that are
|
|
provided as part of warning or extension diagnostics. All of the
|
|
warnings will be fixed by -fixit, and the resulting file should
|
|
compile cleanly with -Werror -pedantic. */
|
|
|
|
// FIXME: FIX-IT should add #include <string.h>?
|
|
int strcmp(const char *s1, const char *s2);
|
|
|
|
void f0(void) { }; // expected-warning {{';'}}
|
|
|
|
struct s {
|
|
int x, y;; // expected-warning {{extra ';'}}
|
|
};
|
|
|
|
// CHECK: _Complex double cd;
|
|
_Complex cd; // expected-warning {{assuming '_Complex double'}}
|
|
|
|
// CHECK: struct s s0 = { .y = 5 };
|
|
struct s s0 = { y: 5 }; // expected-warning {{GNU old-style}}
|
|
|
|
// CHECK: int array0[5] = { [3] = 3 };
|
|
int array0[5] = { [3] 3 }; // expected-warning {{GNU 'missing ='}}
|
|
|
|
// CHECK: int x
|
|
// CHECK: int y
|
|
void f1(x, y) // expected-error 2{{was not declared, defaults to 'int'; ISO C99 and later do not support implicit int}}
|
|
{
|
|
}
|
|
|
|
int i0 = { 17 };
|
|
|
|
#define ONE 1
|
|
#define TWO 2
|
|
|
|
int test_cond(int y, int fooBar) { // expected-note {{here}}
|
|
// CHECK: int x = y ? 1 : 4+fooBar;
|
|
int x = y ? 1 4+foobar; // expected-error {{expected ':'}} expected-error {{undeclared identifier}} expected-note {{to match}}
|
|
// CHECK: x = y ? ONE : TWO;
|
|
x = y ? ONE TWO; // expected-error {{':'}} expected-note {{to match}}
|
|
return x;
|
|
}
|
|
|
|
// CHECK: const typedef int int_t;
|
|
const typedef typedef int int_t; // expected-warning {{duplicate 'typedef'}}
|
|
|
|
enum Color {
|
|
Red // expected-error{{missing ',' between enumerators}}
|
|
Green = 17 // expected-error{{missing ',' between enumerators}}
|
|
Blue,
|
|
};
|
|
|
|
struct test_struct {
|
|
// CHECK: struct test_struct *struct_ptr;
|
|
test_struct *struct_ptr; // expected-error {{must use 'struct' tag to refer to type 'test_struct'}}
|
|
};
|
|
|
|
void removeUnusedLabels(char c) {
|
|
L0 /*removed comment*/: c++; // expected-warning {{unused label}}
|
|
removeUnusedLabels(c);
|
|
L1: // expected-warning {{unused label}}
|
|
c++;
|
|
/*preserved comment*/ L2 : c++; // expected-warning {{unused label}}
|
|
LL // expected-warning {{unused label}}
|
|
: c++;
|
|
c = c + 3; L4: return; // expected-warning {{unused label}}
|
|
}
|
|
|
|
int oopsAComma = 0, // expected-error {{';'}}
|
|
void oopsMoreCommas(void) {
|
|
static int a[] = { 0, 1, 2 }, // expected-error {{';'}}
|
|
static int b[] = { 3, 4, 5 }, // expected-error {{';'}}
|
|
&a == &b ? oopsMoreCommas() : removeUnusedLabels(a[0]);
|
|
}
|
|
|
|
int commaAtEndOfStatement(void) {
|
|
int a = 1;
|
|
a = 5, // expected-error {{';'}}
|
|
int m = 5, // expected-error {{';'}}
|
|
return 0, // expected-error {{';'}}
|
|
}
|
|
|
|
struct noSemiAfterStruct // expected-error {{expected ';' after struct}}
|
|
struct noSemiAfterStruct {
|
|
int n // expected-warning {{';'}}
|
|
} // expected-error {{expected ';' after struct}}
|
|
enum noSemiAfterEnum {
|
|
e1
|
|
} // expected-error {{expected ';' after enum}}
|
|
|
|
int PR17175 __attribute__((visibility(hidden))); // expected-error {{'visibility' attribute requires a string}}
|