On Wed, Mar 05, 2025 at 08:27:53PM +0000, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote: > > We could change this to a macro instead: > > > > -static inline void setproctitle_init (int, char *[], char *[]) {} > > +#define setproctitle_init(c, a, e) > > Changing to the empty marco removes the side effects in the arguments (such > as len++, for example), > which may silently break existing code -- so I think it's not a good idea. > If the idea to use the empty > arguments was not to implicitly document them (because the API was slated for > removal, IIRC), then > naming them just with "arg1", "arg2" (rather than leaving empty altogether) > should help better, IMO. > > Anton Lavrentiev > Contractor NIH/NLM/NCBI
If you want the side effects of the arguments and still want a macro: #define setproctitle_init(c, a, e) \ do { (void)(c); (void)(a); (void)(e); } while (0) or, since it is unlikely (though possible) that someone has defined a single-letter macro for 'c', 'a', or 'b': static inline void setproctitle_init (int c, char *a[], char *b[]) { (void)(c); (void)(a); (void)(e); } or use the intended, more descriptive names in the prototype static inline void setproctitle_init (int argc, char *argv[], char *envp[]) { (void)(argc); (void)(argv); (void)(envp); } If gcc or clang, you could also add __attribute__((__unused__)), though it should probaby be its own macro so that it could be no-op for certain compilers: There is also [[maybe_unused]] https://clang.llvm.org/docs/AttributeReference.html#maybe-unused-unused https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4189?view=msvc-170 #ifndef __attribute_unused__ #ifdef _MSC_VER #define __attribute_unused__ [[maybe_unused]] #else #define __attribute_unused__ __attribute__((__unused__)), #endif #endif static inline void setproctitle_init (int argc __attribute_unused__, char *argv[] __attribute_unused__, char *envp[] __attribute_unused__) { (void)(argc); (void)(argv); (void)(envp); } Cheers, Glenn -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple