attr-5.c

来自「this is a gcc file, you can download it 」· C语言 代码 · 共 29 行

C
29
字号
/* Test for format attributes: test default attributes are silently ignored   when a function is redeclared in an inappropriate manner.  *//* Origin: Joseph Myers <jsm28@cam.ac.uk> *//* { dg-do compile } *//* { dg-options "-std=gnu99 -Wformat" } *//* We can't #include "format.h" here.  *//* This scanf declaration is static, so can't be the system function.  */static int scanf(const char *restrict, ...);/* This sscanf declaration doesn't have variable arguments, so isn't   compatible with a format attribute.  */extern int sscanf(const char *restrict, const char *restrict, int *); /* { dg-warning "conflict" "conflict" } */voidfoo (const char *s, int *p){  scanf("%ld", p); /* { dg-bogus "format" "static" } */  sscanf(s, "%ld", p); /* { dg-bogus "format" "wrong type" } */}/* Dummy definition of scanf.  */static intscanf (const char *restrict fmt, ...){  return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?