Re: [Mingw-w64-public] winpthreads doesn't export clock_* functions
Hi Ozkan. I checked out your patch. But the problem remained. clock_ * functions are not exported. I attach a patch. Check it out please. niXman. 2012/1/4 Ozkan Sezer seze...@gmail.com: On Wed, Jan 4, 2012 at 6:32 PM, niXman i.nix...@gmail.com wrote: No, I have not tested your patch. I only agreed that your patch is easier, and suggested that you check it. Well then, next time I will strive to understand hidden meanings in other people's text At any rate, I applied the attached minor patch to compile it (the makefile CFLAGS parts of it is to reduce the preprocessed source size) was able to compile it and the resulting dll seems to have the clock.c functions. Do test this time, please. 2012/1/4 Ozkan Sezer seze...@gmail.com: On Wed, Jan 4, 2012 at 4:58 PM, Ruben Van Boxem vanboxem.ru...@gmail.com wrote: 2012/1/4 niXman i.nix...@gmail.com Hi Ozkan. I test the winpthread(rev 4706) with you patch. But clock_* functions also not exported. I don't have the earlier mails from this thread, but I remember that you reported success with the patch only after that I applied it. How did it succeed that time and now it doesn't? I saw the same behavior yesterday. The dll does not contain the clock_gettime and nanosleep. The static lib does. I'm starting to think this might be causing the libstdc++ dll exception issue (due to configure failing to link these). Might be me rambling, but hey, I'll test it anyways once this is fixed. Ruben 2011/12/28 Ozkan Sezer seze...@gmail.com: On Wed, Dec 28, 2011 at 1:02 PM, niXman i.nix...@gmail.com wrote: Patch is attached. May be useful. 2011/12/28 niXman i.nix...@gmail.com: If I move declarations of clock_* functions from pthread_time.h to pthread.h then the problem is solved. But I am not sure that it's right. Does the following one-liner fix it? Index: src/clock.c === --- src/clock.c (revision 4705) +++ src/clock.c (working copy) @@ -10,6 +10,7 @@ #include windows.h #include pthread.h +#include pthread_time.h #define POW10_7 1000 #define POW10_9 10 2011/12/28 JonY jo...@users.sourceforge.net: On 12/28/2011 07:15, niXman wrote: Hello list. I built the winpthreads and detected that libwinpthread-1.dll does not export the clock_* functions. __pth_gpointer_locked __pthread_clock_nanosleep _pthread_cleanup_dest _pthread_get_state _pthread_invoke_cancel _pthread_key_dest _pthread_rel_time_in_ms _pthread_set_state _pthread_time_in_ms _pthread_time_in_ms_from_timespec _pthread_tryjoin pthread_attr_destroy pthread_attr_getdetachstate pthread_attr_getinheritsched pthread_attr_getschedparam pthread_attr_getscope pthread_attr_getstackaddr pthread_attr_getstacksize pthread_attr_init pthread_attr_setdetachstate pthread_attr_setinheritsched pthread_attr_setschedparam pthread_attr_setscope pthread_attr_setstackaddr pthread_attr_setstacksize pthread_barrier_destroy pthread_barrier_init pthread_barrier_wait pthread_barrierattr_destroy pthread_barrierattr_getpshared pthread_barrierattr_init pthread_barrierattr_setpshared pthread_cancel pthread_cond_broadcast pthread_cond_destroy pthread_cond_init pthread_cond_signal pthread_cond_timedwait pthread_cond_wait pthread_condattr_destroy pthread_condattr_getclock pthread_condattr_getpshared pthread_condattr_init pthread_condattr_setclock pthread_condattr_setpshared pthread_create pthread_create_wrapper pthread_delay_np pthread_detach pthread_equal pthread_exit pthread_get_concurrency pthread_getclean pthread_getconcurrency pthread_getevent pthread_gethandle pthread_getschedparam pthread_getspecific pthread_join pthread_key_create pthread_key_delete pthread_kill pthread_mutex_destroy pthread_mutex_init pthread_mutex_lock pthread_mutex_timedlock pthread_mutex_trylock pthread_mutex_unlock pthread_mutexattr_destroy pthread_mutexattr_getprioceiling pthread_mutexattr_getprotocol pthread_mutexattr_getpshared pthread_mutexattr_gettype pthread_mutexattr_init pthread_mutexattr_setprioceiling pthread_mutexattr_setprotocol pthread_mutexattr_setpshared pthread_mutexattr_settype pthread_num_processors_np pthread_once pthread_rwlock_destroy pthread_rwlock_init pthread_rwlock_rdlock pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock pthread_rwlock_tryrdlock pthread_rwlock_trywrlock pthread_rwlock_unlock pthread_rwlock_wrlock pthread_rwlockattr_destroy pthread_rwlockattr_getpshared pthread_rwlockattr_init pthread_rwlockattr_setpshared pthread_self pthread_set_concurrency pthread_set_num_processors_np pthread_setcancelstate pthread_setcanceltype pthread_setconcurrency pthread_setschedparam pthread_setspecific pthread_spin_destroy
Re: [Mingw-w64-public] winpthreads doesn't export clock_* functions
On Tue, Jan 17, 2012 at 12:49 PM, niXman i.nix...@gmail.com wrote: Hi Ozkan. I checked out your patch. But the problem remained. clock_ * functions are not exported. I attach a patch. Check it out please. niXman. Note that wihpthreads is at rev.4718 in the svn: make sure that you are using the latest. With rev. 4718, I compiled for both x86 and for x86_64, I always saw the clock* functions in the dll. Not making a comment on your patch for the moment, (other, please take a look at it if you can), however, I do wonder how the preprocessed sources (-save-temps) look like when you are compiling winpthreads: can you please provide that information? -- O.S. -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] winpthreads doesn't export clock_* functions
On Tue, Jan 17, 2012 at 1:24 PM, niXman i.nix...@gmail.com wrote: 2012/1/17 Ozkan Sezer seze...@gmail.com: On Tue, Jan 17, 2012 at 12:49 PM, niXman i.nix...@gmail.com wrote: Hi Ozkan. I checked out your patch. But the problem remained. clock_ * functions are not exported. I attach a patch. Check it out please. niXman. Note that wihpthreads is at rev.4718 in the svn: make sure that you are using the latest. With rev. 4718, I compiled for both x86 and for x86_64, I always saw the clock* functions in the dll. Yes, this revision and I'm using. Downloaded an hour ago. Not making a comment on your patch for the moment, (other, please take a look at it if you can), however, I do wonder how the preprocessed sources (-save-temps) look like when you are compiling winpthreads: can you please provide that information? Attached. OK, this is because of the oh-so-wonderful-and-so-great idea of including pthread_time.h from within time.h, and you obviously have pthread_time.h among the system headers. Does the attached patch help? Kai, Jon: OK to apply? --- time.h~ +++ time.h @@ -279,8 +279,9 @@ /* POSIX 2008 says clock_gettime and timespec are defined in time.h header, but other systems - like Linux, Solaris, etc - tend to declare such recent extensions only if the following guards are met. */ -#if (!defined(_STRICT_STDC) !defined(__XOPEN_OR_POSIX)) || \ - (_POSIX_C_SOURCE 2) || defined(__EXTENSIONS__) +#if !defined(IN_WINPTHREAD) \ + ((!defined(_STRICT_STDC) !defined(__XOPEN_OR_POSIX)) || \ +(_POSIX_C_SOURCE 2) || defined(__EXTENSIONS__)) #include pthread_time.h #endif -- O.S. time.diff Description: Binary data -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] winpthreads doesn't export clock_* functions
On Tue, Jan 17, 2012 at 2:22 PM, Kai Tietz ktiet...@googlemail.com wrote: 2012/1/17 Ozkan Sezer seze...@gmail.com: On Tue, Jan 17, 2012 at 1:24 PM, niXman i.nix...@gmail.com wrote: 2012/1/17 Ozkan Sezer seze...@gmail.com: On Tue, Jan 17, 2012 at 12:49 PM, niXman i.nix...@gmail.com wrote: Hi Ozkan. I checked out your patch. But the problem remained. clock_ * functions are not exported. I attach a patch. Check it out please. niXman. Note that wihpthreads is at rev.4718 in the svn: make sure that you are using the latest. With rev. 4718, I compiled for both x86 and for x86_64, I always saw the clock* functions in the dll. Yes, this revision and I'm using. Downloaded an hour ago. Not making a comment on your patch for the moment, (other, please take a look at it if you can), however, I do wonder how the preprocessed sources (-save-temps) look like when you are compiling winpthreads: can you please provide that information? Attached. OK, this is because of the oh-so-wonderful-and-so-great idea of including pthread_time.h from within time.h, and you obviously have pthread_time.h among the system headers. Does the attached patch help? Kai, Jon: OK to apply? --- time.h~ +++ time.h @@ -279,8 +279,9 @@ /* POSIX 2008 says clock_gettime and timespec are defined in time.h header, but other systems - like Linux, Solaris, etc - tend to declare such recent extensions only if the following guards are met. */ -#if (!defined(_STRICT_STDC) !defined(__XOPEN_OR_POSIX)) || \ - (_POSIX_C_SOURCE 2) || defined(__EXTENSIONS__) +#if !defined(IN_WINPTHREAD) \ + ((!defined(_STRICT_STDC) !defined(__XOPEN_OR_POSIX)) || \ + (_POSIX_C_SOURCE 2) || defined(__EXTENSIONS__)) #include pthread_time.h #endif -- O.S. Ah, that's the cause. Grr, yes patch is ok. Applied to v2.x at rev. 4740, to trunk at rev. 4741. But maybe we should use here for winpthread instead absolute includes (via #include ../include/...) to avoid that system-header is choosen. No, the issue is not about picking the wrong header, it is about the include order: time.h gets included before pthread.h therefore the declspec directives weren't defined correctly for the clock functions. Kai -- O.S. -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ 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] Cygwin mingw64-i686-gcc-4.5.3-4: -Wformat warnings broken in C++
Christian Franke wrote: Kai Tietz wrote: The point about C++ is, that we lack a default prototype. Yes, but if some int printf(const char *, ...) prototype is specified, __attribute__((format(printf(1,2))) from builtin info is always added silently by g++. Even an __attribute__(format(gnu_printf(1,2))) in the prototype does not prevent this. Root of the problem is that the C++ compiler does not properly shadow a hidden builtin if reimplemented as a static with C linkage. It merges the builtin attributes instead. Probably a subtle bug around gcc-4.5.3/gcc/cp/decl.c:dublicate_decls(). The following testcase shows that format errors common to ms_printf and gnu_printf are reported twice in C++. This likely proves that both attributes are set internally: $ cat testfmt3.c #ifdef __cplusplus extern C { #endif static __attribute__((format(gnu_printf,1,2))) int printf(const char *fmt, ...) { return 0; }; #ifdef __cplusplus } #endif int main() { printf(%ld, 42); // C++: 2 warnings printf(%lld, 42LL); // C++: bogus warning printf(%I64d, 42LL); } $ i686-w64-mingw32-gcc -Wshadow -Wformat -c testfmt3.c testfmt3.c:7:5: warning: declaration of 'printf' shadows a built-in function testfmt3.c: In function 'main': testfmt3.c:15:3: warning: format '%ld' expects type 'long int', but argument 2 has type 'int' testfmt3.c:17:3: warning: format '%I64d' expects type 'int', but argument 2 has type 'long long int' $ i686-w64-mingw32-g++ -Wshadow -Wformat -c testfmt3.c testfmt3.c: In function 'int main()': testfmt3.c:15:19: warning: format '%ld' expects type 'long int', but argument 2 has type 'int' testfmt3.c:15:19: warning: format '%ld' expects type 'long int', but argument 2 has type 'int' testfmt3.c:16:22: warning: unknown conversion type character 'l' in format testfmt3.c:16:22: warning: too many arguments for format testfmt3.c:17:23: warning: format '%I64d' expects type 'int', but argument 2 has type 'long long int' Meantime I found an easy workaround: Use C++ linkage for printf wrapper functions, see attached patch. Smoke tested with smartmontools build. As a positive side effect this produces less code than in C: e.g. one __Z6printfPKcz per program instead of one _printf per module :-) Christian --- stdio.h.orig 2012-01-07 06:42:43.00100 +0100 +++ stdio.h 2012-01-17 14:09:59.939569000 +0100 @@ -201,6 +201,10 @@ * User has expressed a preference for C99 conformance... */ +#ifdef __cplusplus +extern C++ { +#endif + __mingw_ovr __attribute__((__format__ (gnu_scanf, 2, 3))) __MINGW_ATTRIB_NONNULL(2) int sscanf(const char *__source, const char *__format, ...) @@ -355,6 +359,10 @@ /* #endif */ /* __NO_ISOCEXT */ +#ifdef __cplusplus +} +#endif + #else /* !__USE_MINGW_ANSI_STDIO */ #undef __builtin_vsnprintf -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] winpthreads doesn't export clock_* functions
2012/1/17 Ozkan Sezer seze...@gmail.com: On Tue, Jan 17, 2012 at 1:24 PM, niXman i.nix...@gmail.com wrote: 2012/1/17 Ozkan Sezer seze...@gmail.com: On Tue, Jan 17, 2012 at 12:49 PM, niXman i.nix...@gmail.com wrote: Hi Ozkan. I checked out your patch. But the problem remained. clock_ * functions are not exported. I attach a patch. Check it out please. niXman. Note that wihpthreads is at rev.4718 in the svn: make sure that you are using the latest. With rev. 4718, I compiled for both x86 and for x86_64, I always saw the clock* functions in the dll. Yes, this revision and I'm using. Downloaded an hour ago. Not making a comment on your patch for the moment, (other, please take a look at it if you can), however, I do wonder how the preprocessed sources (-save-temps) look like when you are compiling winpthreads: can you please provide that information? Attached. OK, this is because of the oh-so-wonderful-and-so-great idea of including pthread_time.h from within time.h, and you obviously have pthread_time.h among the system headers. Does the attached patch help? No. The problem are still not solved. niXman. Kai, Jon: OK to apply? --- time.h~ +++ time.h @@ -279,8 +279,9 @@ /* POSIX 2008 says clock_gettime and timespec are defined in time.h header, but other systems - like Linux, Solaris, etc - tend to declare such recent extensions only if the following guards are met. */ -#if (!defined(_STRICT_STDC) !defined(__XOPEN_OR_POSIX)) || \ - (_POSIX_C_SOURCE 2) || defined(__EXTENSIONS__) +#if !defined(IN_WINPTHREAD) \ + ((!defined(_STRICT_STDC) !defined(__XOPEN_OR_POSIX)) || \ + (_POSIX_C_SOURCE 2) || defined(__EXTENSIONS__)) #include pthread_time.h #endif -- O.S. -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] winpthreads doesn't export clock_* functions
On Wed, Jan 18, 2012 at 8:05 AM, niXman i.nix...@gmail.com wrote: 2012/1/17 Ozkan Sezer seze...@gmail.com: On Tue, Jan 17, 2012 at 1:24 PM, niXman i.nix...@gmail.com wrote: 2012/1/17 Ozkan Sezer seze...@gmail.com: On Tue, Jan 17, 2012 at 12:49 PM, niXman i.nix...@gmail.com wrote: Hi Ozkan. I checked out your patch. But the problem remained. clock_ * functions are not exported. I attach a patch. Check it out please. niXman. Note that wihpthreads is at rev.4718 in the svn: make sure that you are using the latest. With rev. 4718, I compiled for both x86 and for x86_64, I always saw the clock* functions in the dll. Yes, this revision and I'm using. Downloaded an hour ago. Not making a comment on your patch for the moment, (other, please take a look at it if you can), however, I do wonder how the preprocessed sources (-save-temps) look like when you are compiling winpthreads: can you please provide that information? Attached. OK, this is because of the oh-so-wonderful-and-so-great idea of including pthread_time.h from within time.h, and you obviously have pthread_time.h among the system headers. Does the attached patch help? No. The problem are still not solved. niXman. Then I am out of ideas, however I must see the preprocessed sources again, the ones from the build with the time.h change applied Kai, Jon: OK to apply? --- time.h~ +++ time.h @@ -279,8 +279,9 @@ /* POSIX 2008 says clock_gettime and timespec are defined in time.h header, but other systems - like Linux, Solaris, etc - tend to declare such recent extensions only if the following guards are met. */ -#if (!defined(_STRICT_STDC) !defined(__XOPEN_OR_POSIX)) || \ - (_POSIX_C_SOURCE 2) || defined(__EXTENSIONS__) +#if !defined(IN_WINPTHREAD) \ + ((!defined(_STRICT_STDC) !defined(__XOPEN_OR_POSIX)) || \ + (_POSIX_C_SOURCE 2) || defined(__EXTENSIONS__)) #include pthread_time.h #endif -- O.S. -- O.S. -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] winpthreads doesn't export clock_* functions
Look sched.h and semaphore.h headers. They both are defined macros to export. I offered the same patch. What my patch does not suit you? 2012/1/18 Ozkan Sezer seze...@gmail.com: On Wed, Jan 18, 2012 at 8:05 AM, niXman i.nix...@gmail.com wrote: 2012/1/17 Ozkan Sezer seze...@gmail.com: On Tue, Jan 17, 2012 at 1:24 PM, niXman i.nix...@gmail.com wrote: 2012/1/17 Ozkan Sezer seze...@gmail.com: On Tue, Jan 17, 2012 at 12:49 PM, niXman i.nix...@gmail.com wrote: Hi Ozkan. I checked out your patch. But the problem remained. clock_ * functions are not exported. I attach a patch. Check it out please. niXman. Note that wihpthreads is at rev.4718 in the svn: make sure that you are using the latest. With rev. 4718, I compiled for both x86 and for x86_64, I always saw the clock* functions in the dll. Yes, this revision and I'm using. Downloaded an hour ago. Not making a comment on your patch for the moment, (other, please take a look at it if you can), however, I do wonder how the preprocessed sources (-save-temps) look like when you are compiling winpthreads: can you please provide that information? Attached. OK, this is because of the oh-so-wonderful-and-so-great idea of including pthread_time.h from within time.h, and you obviously have pthread_time.h among the system headers. Does the attached patch help? No. The problem are still not solved. niXman. Then I am out of ideas, however I must see the preprocessed sources again, the ones from the build with the time.h change applied Kai, Jon: OK to apply? --- time.h~ +++ time.h @@ -279,8 +279,9 @@ /* POSIX 2008 says clock_gettime and timespec are defined in time.h header, but other systems - like Linux, Solaris, etc - tend to declare such recent extensions only if the following guards are met. */ -#if (!defined(_STRICT_STDC) !defined(__XOPEN_OR_POSIX)) || \ - (_POSIX_C_SOURCE 2) || defined(__EXTENSIONS__) +#if !defined(IN_WINPTHREAD) \ + ((!defined(_STRICT_STDC) !defined(__XOPEN_OR_POSIX)) || \ + (_POSIX_C_SOURCE 2) || defined(__EXTENSIONS__)) #include pthread_time.h #endif -- O.S. -- O.S. -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] winpthreads doesn't export clock_* functions
On Wed, Jan 18, 2012 at 9:14 AM, niXman i.nix...@gmail.com wrote: Look sched.h and semaphore.h headers. They both are defined macros to export. I offered the same patch. What my patch does not suit you? First, I said that I left that patch to others to review and decide. Second, and more importantly, I must understand why it does not work with you: Are you sure that you patched the time.h in your toolchain installation? And, since you didn't send the preprocessed sources, I still don't know what is going on on your end. -- O.S. -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public