]> git.proxmox.com Git - mirror_lxcfs.git/commit
macro: fix lxcfs_{error,debug,v} build error when __VA_ARGS__ is empty
authorriver <river@vvl.me>
Mon, 26 Aug 2019 10:01:12 +0000 (18:01 +0800)
committerriver <river@vvl.me>
Mon, 26 Aug 2019 10:13:00 +0000 (18:13 +0800)
commit5faa9af7e70a2f7a8df658eb54d24c6519b24b5f
tree236bf7b01ab8536bffd80c1bba4de219c9aa3b57
parent9d494a0fe8114e456329c532898eb35fbf57a229
macro: fix lxcfs_{error,debug,v} build error when __VA_ARGS__ is empty

Originally, the compiler complained:
  macro.h:7:25: error: expected expression before ')' token
      __func__, __VA_ARGS__);

The reason is that GCC wouldn't abandon `,` when `__VA_ARGS__` is empty.
For emaple:
  #define eprintf(format, ...) fprintf (stderr, format, __VA_ARGS__)
  eprintf("success!\n", );
       → fprintf(stderr, "success!\n", );

According to GCC doc, it's okay when adding `##` before `__VA_ARGS__`:
  #define eprintf(format, ...) fprintf (stderr, format, ##__VA_ARGS__)
  eprintf ("success!\n")
       → fprintf(stderr, "success!\n");

Signed-off-by: river <river@vvl.me>
macro.h