Пример #1
0
int main() {
  plainFunction();
  externFunction();
  privateExternFunction();
  staticFunction();

  return 0;
}
Пример #2
0
inline int useStaticAgain () { // expected-note 2 {{use 'static' to give inline function 'useStaticAgain' internal linkage}}
  staticFunction(); // expected-warning{{static function 'staticFunction' is used in an inline function with external linkage}}
  return staticVar; // expected-warning{{static variable 'staticVar' is used in an inline function with external linkage}}
}
Пример #3
0
inline int useStaticMainFile () {
  staticFunction(); // no-warning
  return staticVar; // no-warning
}
Пример #4
0
static inline int useStaticFromStatic () {
  staticFunction(); // no-warning
  return staticVar; // no-warning
}
Пример #5
0
extern inline int useStaticFromExtern () { // no suggestions
  staticFunction(); // expected-warning{{static function 'staticFunction' is used in an inline function with external linkage}}
  return staticVar; // expected-warning{{static variable 'staticVar' is used in an inline function with external linkage}}
}
Пример #6
0
inline int useStatic () { // expected-note 3 {{use 'static' to give inline function 'useStatic' internal linkage}}
  staticFunction(); // expected-warning{{static function 'staticFunction' is used in an inline function with external linkage}}
  (void)staticStruct.x; // expected-warning{{static variable 'staticStruct' is used in an inline function with external linkage}}
  return staticVar; // expected-warning{{static variable 'staticVar' is used in an inline function with external linkage}}
}
Пример #7
0
inline int useStaticMainFileAfterLineMarker() {
  staticFunction(); // no-warning
  return staticVar; // no-warning
}