kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

attr_09_format_printf.c (451B)


      1 /* __attribute__((format(printf, m, n))) on a varargs function
      2  * definition. Phase 1 only needs to accept the attribute shape; the
      3  * function body is `static` and unreferenced to avoid an unresolved
      4  * external at link. */
      5 __attribute__((format(printf, 1, 2))) static int my_printf(const char* fmt,
      6                                                            ...) {
      7   (void)fmt;
      8   return 0;
      9 }
     10 
     11 int test_main(void) {
     12   (void)&my_printf;
     13   return 0;
     14 }