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
58 lines
2.3 KiB
C
58 lines
2.3 KiB
C
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-undef %s
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-undef -Wno-unknown-warning-option -DAVOID_UNKNOWN_WARNING %s
|
|
|
|
#if FOO // ok.
|
|
#endif
|
|
|
|
#pragma GCC diagnostic warning "-Wundef"
|
|
|
|
#if FOO // expected-warning {{'FOO' is not defined}}
|
|
#endif
|
|
|
|
#pragma GCC diagnostic ignored "-Wun" "def"
|
|
|
|
#if FOO // ok.
|
|
#endif
|
|
|
|
#pragma GCC diagnostic error "-Wundef"
|
|
|
|
#if FOO // expected-error {{'FOO' is not defined}}
|
|
#endif
|
|
|
|
|
|
#define foo error
|
|
#pragma GCC diagnostic foo "-Wundef" // expected-warning {{pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'}}
|
|
|
|
#pragma GCC diagnostic error 42 // expected-error {{expected string literal in pragma diagnostic}}
|
|
|
|
#pragma GCC diagnostic error "-Wundef" 42 // expected-warning {{unexpected token in pragma diagnostic}}
|
|
#pragma GCC diagnostic error "invalid-name" // expected-warning {{pragma diagnostic expected option name (e.g. "-Wundef")}}
|
|
|
|
#pragma GCC diagnostic error "-Winvalid-name"
|
|
#ifndef AVOID_UNKNOWN_WARNING
|
|
// expected-warning@-2 {{unknown warning group '-Winvalid-name', ignored}}
|
|
#endif
|
|
|
|
// From GH13920
|
|
#pragma clang diagnostic push ignored "-Wdeprecated-declarations" // expected-warning {{unexpected token in pragma diagnostic}}
|
|
#pragma clang diagnostic pop ignored "-Wdeprecated-declarations" // expected-warning {{unexpected token in pragma diagnostic}}
|
|
|
|
|
|
// Testing pragma clang diagnostic with -Weverything
|
|
void ppo(void){} // First test that we do not diagnose on this.
|
|
|
|
#pragma clang diagnostic warning "-Weverything"
|
|
void ppp(void){} // expected-warning {{no previous prototype for function 'ppp'}}
|
|
// expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
|
|
|
|
#pragma clang diagnostic ignored "-Weverything" // Reset it.
|
|
void ppq(void){}
|
|
|
|
#pragma clang diagnostic error "-Weverything" // Now set to error
|
|
void ppr(void){} // expected-error {{no previous prototype for function 'ppr'}}
|
|
// expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
|
|
|
|
#pragma clang diagnostic warning "-Weverything" // This should not be effective
|
|
void pps(void){} // expected-error {{no previous prototype for function 'pps'}}
|
|
// expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
|