view gcc/testsuite/g++.dg/spellcheck-identifiers-2.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line source

/* PR c/71858 */
/* Make sure anticipated builtins are not considered before they are declared.  */
/* { dg-do compile } */
/* { dg-options "-fdiagnostics-show-caret" } */

int sscafn (const char *, const char *, ...);

int
test_1 (const char *p)
{
  int i;
  return ssacnf (p, "%d", &i); /* { dg-error "10: .ssacnf. was not declared in this scope" } */
  /* { dg-begin-multiline-output "" }
   return ssacnf (p, "%d", &i);
          ^~~~~~
   { dg-end-multiline-output "" } */
  // { dg-message "10: suggested alternative: 'sscafn'" "" { target *-*-* } 12 }
  /* { dg-begin-multiline-output "" }
   return ssacnf (p, "%d", &i);
          ^~~~~~
          sscafn
   { dg-end-multiline-output "" } */
}

int scafn (const char *, ...);
int scanf (const char *, ...);

int
test_2 (void)
{
  int i;
  return sacnf ("%d", &i); /* { dg-error "10: .sacnf. was not declared in this scope" } */
  /* { dg-begin-multiline-output "" }
   return sacnf ("%d", &i);
          ^~~~~
   { dg-end-multiline-output "" } */
  // { dg-message "10: suggested alternative: 'scanf'" "" { target *-*-* } 32 }
  /* { dg-begin-multiline-output "" }
   return sacnf ("%d", &i);
          ^~~~~
          scanf
   { dg-end-multiline-output "" } */
}