Re: [Mingw-w64-public] [PATCH] winpthreads: Add a missing (void) in the parameters for pthread_getevent
On Fri, 18 Feb 2022, LIU Hao wrote: 在 2/18/22 00:23, NightStrike 写道: Adding unnecessary spam because of yet another poor choice of clang is not something we should be catering towards. Users can compile with -Wno-strict-prototypes if it bothers them that much. No this is not 'unnecessary'. In C the declaration `void* pthread_getevent();` is equivalent to `void* pthread_getevent(...);` despite lack of any means to get arguments (`va_start` requires a named parameter). Ancient code that predated ISO C used to define functions like int fputc(); /* declaration */ int fputc() /* definition*/ int c; /* arguments */ FILE* fp; { /* ... */ } so empty parentheses are there to provide compatibility, and leaving them there for now is not only not unnecessary, but totally incorrect in C. Thanks, I pushed the patch then. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] winpthreads: Add a missing (void) in the parameters for pthread_getevent
在 2/18/22 00:23, NightStrike 写道: Adding unnecessary spam because of yet another poor choice of clang is not something we should be catering towards. Users can compile with -Wno-strict-prototypes if it bothers them that much. No this is not 'unnecessary'. In C the declaration `void* pthread_getevent();` is equivalent to `void* pthread_getevent(...);` despite lack of any means to get arguments (`va_start` requires a named parameter). Ancient code that predated ISO C used to define functions like int fputc(); /* declaration */ int fputc() /* definition*/ int c; /* arguments */ FILE* fp; { /* ... */ } so empty parentheses are there to provide compatibility, and leaving them there for now is not only not unnecessary, but totally incorrect in C. -- Best regards, LIU Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] winpthreads: Add a missing (void) in the parameters for pthread_getevent
On 2/17/22, Martin Storsjö wrote: > On Thu, 17 Feb 2022, NightStrike wrote: > >> On Thu, Feb 17, 2022 at 8:27 AM Martin Storsjö wrote: >>> >>> This avoids warnings if building code including it, with >>> -Wstrict-prototypes. (Latest Clang defaults to enabling this warning >>> by default.) >>> >>> Signed-off-by: Martin Storsjö >>> --- >>> mingw-w64-libraries/winpthreads/include/pthread.h | 2 +- >>> mingw-w64-libraries/winpthreads/src/thread.c | 2 +- >>> 2 files changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h >>> b/mingw-w64-libraries/winpthreads/include/pthread.h >>> index fe0e821ce..5aadb1cfa 100644 >>> --- a/mingw-w64-libraries/winpthreads/include/pthread.h >>> +++ b/mingw-w64-libraries/winpthreads/include/pthread.h >>> @@ -393,7 +393,7 @@ int WINPTHREAD_API pthread_barrierattr_getpshared(void >>> **attr, int *s); >>> /* Private extensions for analysis and internal use. */ >>> struct _pthread_cleanup ** WINPTHREAD_API pthread_getclean (void); >>> void * WINPTHREAD_API pthread_gethandle (pthread_t t); >>> -void * WINPTHREAD_API pthread_getevent (); >>> +void * WINPTHREAD_API pthread_getevent (void); >>> >>> unsigned long long WINPTHREAD_API _pthread_rel_time_in_ms(const >>> struct timespec *ts); >>> unsigned long long WINPTHREAD_API _pthread_time_in_ms(void); >>> diff --git a/mingw-w64-libraries/winpthreads/src/thread.c >>> b/mingw-w64-libraries/winpthreads/src/thread.c >>> index 55361aec9..e3edbae8a 100644 >>> --- a/mingw-w64-libraries/winpthreads/src/thread.c >>> +++ b/mingw-w64-libraries/winpthreads/src/thread.c >>> @@ -1038,7 +1038,7 @@ pthread_self (void) >>> >>> /* Internal helper for getting event handle of thread T. */ >>> void * >>> -pthread_getevent () >>> +pthread_getevent (void) >>> { >>>_pthread_v *t = __pthread_self_lite (); >>>return (!t ? NULL : t->evStart); >> >> Adding unnecessary spam because of yet another poor choice of clang is >> not something we should be catering towards. Users can compile with >> -Wno-strict-prototypes if it bothers them that much. > > Actually, my comment about Clang was wrong, I was misinformed - this > doesn't have anything to do with Clang at all. > > I saw the warning fly by for every file built, when building a project > that explicitly enables -Wstrict-prototypes. > > // Martin IMO, the patch is good. -- O.S. ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] winpthreads: Add a missing (void) in the parameters for pthread_getevent
On Thu, 17 Feb 2022, NightStrike wrote: On Thu, Feb 17, 2022 at 8:27 AM Martin Storsjö wrote: This avoids warnings if building code including it, with -Wstrict-prototypes. (Latest Clang defaults to enabling this warning by default.) Signed-off-by: Martin Storsjö --- mingw-w64-libraries/winpthreads/include/pthread.h | 2 +- mingw-w64-libraries/winpthreads/src/thread.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h b/mingw-w64-libraries/winpthreads/include/pthread.h index fe0e821ce..5aadb1cfa 100644 --- a/mingw-w64-libraries/winpthreads/include/pthread.h +++ b/mingw-w64-libraries/winpthreads/include/pthread.h @@ -393,7 +393,7 @@ int WINPTHREAD_API pthread_barrierattr_getpshared(void **attr, int *s); /* Private extensions for analysis and internal use. */ struct _pthread_cleanup ** WINPTHREAD_API pthread_getclean (void); void * WINPTHREAD_API pthread_gethandle (pthread_t t); -void * WINPTHREAD_API pthread_getevent (); +void * WINPTHREAD_API pthread_getevent (void); unsigned long long WINPTHREAD_API _pthread_rel_time_in_ms(const struct timespec *ts); unsigned long long WINPTHREAD_API _pthread_time_in_ms(void); diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libraries/winpthreads/src/thread.c index 55361aec9..e3edbae8a 100644 --- a/mingw-w64-libraries/winpthreads/src/thread.c +++ b/mingw-w64-libraries/winpthreads/src/thread.c @@ -1038,7 +1038,7 @@ pthread_self (void) /* Internal helper for getting event handle of thread T. */ void * -pthread_getevent () +pthread_getevent (void) { _pthread_v *t = __pthread_self_lite (); return (!t ? NULL : t->evStart); Adding unnecessary spam because of yet another poor choice of clang is not something we should be catering towards. Users can compile with -Wno-strict-prototypes if it bothers them that much. Actually, my comment about Clang was wrong, I was misinformed - this doesn't have anything to do with Clang at all. I saw the warning fly by for every file built, when building a project that explicitly enables -Wstrict-prototypes. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] winpthreads: Add a missing (void) in the parameters for pthread_getevent
On Thu, 17 Feb 2022, NightStrike wrote: On Thu, Feb 17, 2022 at 8:27 AM Martin Storsjö wrote: This avoids warnings if building code including it, with -Wstrict-prototypes. (Latest Clang defaults to enabling this warning by default.) Signed-off-by: Martin Storsjö --- mingw-w64-libraries/winpthreads/include/pthread.h | 2 +- mingw-w64-libraries/winpthreads/src/thread.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h b/mingw-w64-libraries/winpthreads/include/pthread.h index fe0e821ce..5aadb1cfa 100644 --- a/mingw-w64-libraries/winpthreads/include/pthread.h +++ b/mingw-w64-libraries/winpthreads/include/pthread.h @@ -393,7 +393,7 @@ int WINPTHREAD_API pthread_barrierattr_getpshared(void **attr, int *s); /* Private extensions for analysis and internal use. */ struct _pthread_cleanup ** WINPTHREAD_API pthread_getclean (void); void * WINPTHREAD_API pthread_gethandle (pthread_t t); -void * WINPTHREAD_API pthread_getevent (); +void * WINPTHREAD_API pthread_getevent (void); unsigned long long WINPTHREAD_API _pthread_rel_time_in_ms(const struct timespec *ts); unsigned long long WINPTHREAD_API _pthread_time_in_ms(void); diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libraries/winpthreads/src/thread.c index 55361aec9..e3edbae8a 100644 --- a/mingw-w64-libraries/winpthreads/src/thread.c +++ b/mingw-w64-libraries/winpthreads/src/thread.c @@ -1038,7 +1038,7 @@ pthread_self (void) /* Internal helper for getting event handle of thread T. */ void * -pthread_getevent () +pthread_getevent (void) { _pthread_v *t = __pthread_self_lite (); return (!t ? NULL : t->evStart); Adding unnecessary spam because of yet another poor choice of clang is not something we should be catering towards. Users can compile with -Wno-strict-prototypes if it bothers them that much. Sorry, but in what way is declaring a correct function prototype "spam"? We already do that for some other functions right above, see e.g. pthread_getclean 2 lines above in the header. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] winpthreads: Add a missing (void) in the parameters for pthread_getevent
On Thu, Feb 17, 2022 at 8:27 AM Martin Storsjö wrote: > > This avoids warnings if building code including it, with > -Wstrict-prototypes. (Latest Clang defaults to enabling this warning > by default.) > > Signed-off-by: Martin Storsjö > --- > mingw-w64-libraries/winpthreads/include/pthread.h | 2 +- > mingw-w64-libraries/winpthreads/src/thread.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h > b/mingw-w64-libraries/winpthreads/include/pthread.h > index fe0e821ce..5aadb1cfa 100644 > --- a/mingw-w64-libraries/winpthreads/include/pthread.h > +++ b/mingw-w64-libraries/winpthreads/include/pthread.h > @@ -393,7 +393,7 @@ int WINPTHREAD_API pthread_barrierattr_getpshared(void > **attr, int *s); > /* Private extensions for analysis and internal use. */ > struct _pthread_cleanup ** WINPTHREAD_API pthread_getclean (void); > void * WINPTHREAD_API pthread_gethandle (pthread_t t); > -void * WINPTHREAD_API pthread_getevent (); > +void * WINPTHREAD_API pthread_getevent (void); > > unsigned long long WINPTHREAD_API _pthread_rel_time_in_ms(const > struct timespec *ts); > unsigned long long WINPTHREAD_API _pthread_time_in_ms(void); > diff --git a/mingw-w64-libraries/winpthreads/src/thread.c > b/mingw-w64-libraries/winpthreads/src/thread.c > index 55361aec9..e3edbae8a 100644 > --- a/mingw-w64-libraries/winpthreads/src/thread.c > +++ b/mingw-w64-libraries/winpthreads/src/thread.c > @@ -1038,7 +1038,7 @@ pthread_self (void) > > /* Internal helper for getting event handle of thread T. */ > void * > -pthread_getevent () > +pthread_getevent (void) > { >_pthread_v *t = __pthread_self_lite (); >return (!t ? NULL : t->evStart); Adding unnecessary spam because of yet another poor choice of clang is not something we should be catering towards. Users can compile with -Wno-strict-prototypes if it bothers them that much. ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH] winpthreads: Add a missing (void) in the parameters for pthread_getevent
This avoids warnings if building code including it, with -Wstrict-prototypes. (Latest Clang defaults to enabling this warning by default.) Signed-off-by: Martin Storsjö --- mingw-w64-libraries/winpthreads/include/pthread.h | 2 +- mingw-w64-libraries/winpthreads/src/thread.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h b/mingw-w64-libraries/winpthreads/include/pthread.h index fe0e821ce..5aadb1cfa 100644 --- a/mingw-w64-libraries/winpthreads/include/pthread.h +++ b/mingw-w64-libraries/winpthreads/include/pthread.h @@ -393,7 +393,7 @@ int WINPTHREAD_API pthread_barrierattr_getpshared(void **attr, int *s); /* Private extensions for analysis and internal use. */ struct _pthread_cleanup ** WINPTHREAD_API pthread_getclean (void); void * WINPTHREAD_API pthread_gethandle (pthread_t t); -void * WINPTHREAD_API pthread_getevent (); +void * WINPTHREAD_API pthread_getevent (void); unsigned long long WINPTHREAD_API _pthread_rel_time_in_ms(const struct timespec *ts); unsigned long long WINPTHREAD_API _pthread_time_in_ms(void); diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libraries/winpthreads/src/thread.c index 55361aec9..e3edbae8a 100644 --- a/mingw-w64-libraries/winpthreads/src/thread.c +++ b/mingw-w64-libraries/winpthreads/src/thread.c @@ -1038,7 +1038,7 @@ pthread_self (void) /* Internal helper for getting event handle of thread T. */ void * -pthread_getevent () +pthread_getevent (void) { _pthread_v *t = __pthread_self_lite (); return (!t ? NULL : t->evStart); -- 2.25.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public