llvm-project/clang/test/Sema/function-redecl.c
Aaron Ballman 0f1c1be196 [clang] Remove rdar links; NFC
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
2023-08-28 12:13:42 -04:00

133 lines
3.5 KiB
C

// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -Wno-strict-prototypes -verify %s
// PR3588
void g0(int, int);
void g0(); // expected-note{{previous declaration is here}} expected-note{{'g0' declared here}}
void f0(void) {
g0(1, 2, 3); // expected-error{{too many arguments to function call}}
}
void g0(int); // expected-error{{conflicting types for 'g0'}}
int g1(int, int);
typedef int INT;
INT g1(x, y)
int x;
int y;
{
return x + y;
}
int g2(int, int); // expected-note{{previous declaration is here}}
INT g2(x) // expected-error{{conflicting types for 'g2'}}
int x;
{
return x;
}
void test(void) {
int f1;
{
void f1(double);
{
void f1(double); // expected-note{{previous declaration is here}}
{
int f1(int); // expected-error{{conflicting types for 'f1'}}
}
}
}
}
extern void g3(int); // expected-note{{previous declaration is here}}
static void g3(int x) { } // expected-error{{static declaration of 'g3' follows non-static declaration}}
void test2(void) {
extern int f2; // expected-note 2 {{previous definition is here}}
{
void f2(int); // expected-error{{redefinition of 'f2' as different kind of symbol}}
}
{
int f2;
{
void f2(int); // expected-error{{redefinition of 'f2' as different kind of symbol}}
}
}
}
int outer1(int); // expected-note{{previous declaration is here}}
struct outer3 { };
int outer4(int); // expected-note{{previous declaration is here}}
int outer5; // expected-note{{previous definition is here}}
int *outer7(int);
void outer_test(void) {
int outer1(float); // expected-error{{conflicting types for 'outer1'}}
int outer2(int); // expected-note{{previous declaration is here}}
int outer3(int); // expected-note{{previous declaration is here}}
int outer4(int);
int outer5(int); // expected-error{{redefinition of 'outer5' as different kind of symbol}}
int* outer6(int); // expected-note{{previous declaration is here}}
int *outer7(int);
int outer8(int);
int *ip7 = outer7(6);
}
int outer2(float); // expected-error{{conflicting types for 'outer2'}}
int outer3(float); // expected-error{{conflicting types for 'outer3'}}
int outer4(float); // expected-error{{conflicting types for 'outer4'}}
void outer_test2(int x) {
int* ip = outer6(x); // expected-warning{{use of out-of-scope declaration of 'outer6'}}
int *ip2 = outer7(x);
}
void outer_test3(void) {
int *(*fp)(int) = outer8; // expected-error{{use of undeclared identifier 'outer8'}}
}
enum e { e1, e2 };
// GNU extension: prototypes and K&R function definitions
int isroot(short x, // expected-note{{previous declaration is here}}
enum e);
int isroot(x, y)
short x; // expected-warning{{promoted type 'int' of K&R function parameter is not compatible with the parameter type 'short' declared in a previous prototype}}
unsigned int y;
{
return x == 1;
}
// PR3817
void *h0(unsigned a0, ...);
extern __typeof (h0) h1 __attribute__((__sentinel__));
extern __typeof (h1) h1 __attribute__((__sentinel__));
// PR3840
void i0 (unsigned short a0);
extern __typeof (i0) i1;
extern __typeof (i1) i1;
typedef int a();
typedef int a2(int*);
a x;
a2 x2; // expected-note{{passing argument to parameter here}}
void test_x(void) {
x(5);
x2(5); // expected-error{{incompatible integer to pointer conversion passing 'int' to parameter of type 'int *'}}
}
enum e0 {one};
void f3();
void f3(enum e0 x) {}
enum incomplete_enum;
void f4(); // expected-note {{previous declaration is here}}
void f4(enum incomplete_enum); // expected-error {{conflicting types for 'f4'}}