Commits

ivarun committed d4ca76b

Modify gopt.h to be compatible with clang.

  • Participants
  • Parent commits f3c12e3

Comments (0)

Files changed (1)

 #define GOPT_NOARG  0
 #define GOPT_ARG    2
 
-#define gopt_start(...)  (const void*)( const struct { int k; int f; const char *s; const char*const*l; }[]){ __VA_ARGS__, {0,0,0,0}}
+// Modification of original gopt 8.1 for clang compatibility
+// Used only in gopt_start macro
+struct gopt_opt_spec_s_tmp {
+  int key;
+  int flags;
+  const char *shorts;
+  const char* const *longs;
+};
+
+#define gopt_start(...)  (const void*)( const struct gopt_opt_spec_s_tmp []){ __VA_ARGS__, {0,0,0,0}}
 #define gopt_option(k,f,s,l)    { k, f, s, l }
 #define gopt_shorts( ... )      (const char*)(const char[]){ __VA_ARGS__, 0 }
 #define gopt_longs( ... )       (const char**)(const char*[]){ __VA_ARGS__, NULL }