Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

threads.xs: Fix warning "implicit declaration of function '_setjmpex'" using MinGW-w64 #20116

Merged
merged 1 commit into from
Dec 10, 2022

Conversation

twata1
Copy link
Contributor

@twata1 twata1 commented Aug 18, 2022

When building threads 2.28 using at least gcc-8.5.0, gcc-11.3.0 and gcc-12.1.0 of MinGW-w64, the following warning will appear.

Generating a gmake-style Makefile
Writing Makefile for threads
gmake[1]: Entering directory 'C:/Perl64-gcc10/perl-5.37.2/dist/threads'
Running Mkbootstrap for threads ()
"C:\Perl64-gcc10\perl-5.37.2\miniperl.exe" "-I..\..\lib" -MExtUtils::Command -e chmod -- 644 "threads.bs"
"C:\Perl64-gcc10\perl-5.37.2\miniperl.exe" "-I..\..\lib" -MExtUtils::Command::MM -e cp_nonempty -- threads.bs ..\..\lib\auto\threads\threads.bs 644
"C:\Perl64-gcc10\perl-5.37.2\miniperl.exe" "-I..\..\lib" "C:\Perl64-gcc10\perl-5.37.2\dist\ExtUtils-ParseXS\lib\ExtUtils/xsubpp"  -typemap C:\Perl64-gcc10\perl-5.37.2\lib\ExtUtils\typemap  threads.xs > threads.xsc
"C:\Perl64-gcc10\perl-5.37.2\miniperl.exe" "-I..\..\lib" -MExtUtils::Command -e mv -- threads.xsc threads.c
gcc -c   -DWIN32 -DWIN64 -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields -O2   -DVERSION=\"2.28\" -DXS_VERSION=\"2.28\"  "-I..\..\lib\CORE"   threads.c
threads.xs: In function 'S_jmpenv_run':
threads.xs:18:23: warning: implicit declaration of function '_setjmpex'; did you mean '_setjmp3'? [-Wimplicit-function-declaration]
   18 | #    define setjmp(x) _setjmpex((x), mingw_getsp())
      |                       ^~~~~~~~~
threads.xs:18:23: note: in definition of macro 'setjmp'
   18 | #    define setjmp(x) _setjmpex((x), mingw_getsp())
      |                       ^~~~~~~~~
..\..\lib\CORE/iperlsys.h:1083:33: note: in expansion of macro 'Sigsetjmp'
 1083 | #  define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))
      |                                 ^~~~~~~~~
..\..\lib\CORE/cop.h:122:26: note: in expansion of macro 'PerlProc_setjmp'
  122 |         cur_env.je_ret = PerlProc_setjmp(cur_env.je_buf, SCOPE_SAVES_SIGNAL_MASK);  \
      |                          ^~~~~~~~~~~~~~~
threads.xs:504:5: note: in expansion of macro 'JMPENV_PUSH'
  504 |     JMPENV_PUSH(jmp_rc);
      |     ^~~~~~~~~~~
"C:\Perl64-gcc10\perl-5.37.2\miniperl.exe" "-I..\..\lib" -MExtUtils::Mksymlists \
     -e "Mksymlists('NAME'=>\"threads\", 'DLBASE' => 'threads', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => []);"
g++ threads.def -o ..\..\lib\auto\threads\threads.dll -shared -s -L"c:\perl\lib\CORE" -L"C:\winlibs-x86_64-posix-seh-gcc-10.3.0-llvm-12.0.0-mingw-w64-9.0.0-r2\mingw64\lib" -L"C:\winlibs-x86_64-posix-seh-gcc-10.3.0-llvm-12.0.0-mingw-w64-9.0.0-r2\mingw64\x86_64-w64-mingw32\lib" -L"C:\winlibs-x86_64-posix-seh-gcc-10.3.0-llvm-12.0.0-mingw-w64-9.0.0-r2\mingw64\lib\gcc\x86_64-w64-mingw32\10.3.0" threads.o   "..\..\lib\CORE\libperl537.a" -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -Wl,--enable-auto-image-base
"C:\Perl64-gcc10\perl-5.37.2\miniperl.exe" "-I..\..\lib" -MExtUtils::Command -e chmod -- 755 ..\..\lib\auto\threads\threads.dll

This patch was proposed by @sisyphus.
We have also confirmed that the warning has been suppressed in the following environments.

[Environment]
Windows 8.1 64 bit
Perl 5.37.2
gcc-8.5.0
gcc-11.3.0
gcc-12.1.0

Fixes #20096

@thesamesam
Copy link

I don't think it's really a suppression, it's actually fixing the warning.

@twata1 twata1 force-pushed the mingw-w64-warning-threads.xs branch from c5916e1 to ba26b88 Compare November 19, 2022 09:30
@twata1 twata1 changed the title threads.xs: Suppress warning "implicit declaration of function '_setjmpex'" using MinGW-w64 threads.xs: Fix warning "implicit declaration of function '_setjmpex'" using MinGW-w64 Nov 19, 2022
@twata1
Copy link
Contributor Author

twata1 commented Nov 19, 2022

I changed the word "Suppress" to "Fix" in the commit message and the pull requests title.

@khwilliamson
Copy link
Contributor

Thank you for this patch. I'm ready to merge it, but we need an entry for you as a Perl author. Traditionally this has been a real name and an email address. But we can use just @twata1 if that is what you'd like.

@demerphq
Copy link
Collaborator

demerphq commented Dec 4, 2022 via email

@twata1
Copy link
Contributor Author

twata1 commented Dec 5, 2022

Thank you for your response.
I am trying to do Porting/updateAUTHORS.pl now.

@demerphq
Copy link
Collaborator

demerphq commented Dec 5, 2022

Dont forget to commit and push the results. :-)

@twata1 twata1 force-pushed the mingw-w64-warning-threads.xs branch from ba26b88 to cf1f8a8 Compare December 5, 2022 15:24
@demerphq
Copy link
Collaborator

demerphq commented Dec 5, 2022

Something weird about how you did that. I think you were not rebased onto the latest version of the code. I will find some time later to resolve the conflicts here and figure out what is up. If I run updateAUTHORS.pl against blead right now it does not find anything to update, so i do not know why when you ran it picked up the other people.

@twata1
Copy link
Contributor Author

twata1 commented Dec 5, 2022

I apologize for not rebasing to the latest version of the code.

@demerphq
Copy link
Collaborator

demerphq commented Dec 5, 2022

Not your fault. I should have added an "--add-me" to the tool which would avoid this.

@demerphq
Copy link
Collaborator

demerphq commented Dec 5, 2022

Ok, fixed. You were sufficiently behind blead that you were using an old version of the tool. The new version would have done it different. I have rebased ontop of blead, and will merge once CI finishes. Thanks for the fix, and sorry you had a bad experience for your first PR.

@twata1
Copy link
Contributor Author

twata1 commented Dec 6, 2022

No problem.
Thank you very much for the information about Porting/updateAUTHORS.pl!

@demerphq
Copy link
Collaborator

demerphq commented Dec 6, 2022 via email

@demerphq
Copy link
Collaborator

demerphq commented Dec 6, 2022 via email

@twata1
Copy link
Contributor Author

twata1 commented Dec 9, 2022

I wish someone else can take care of this as I am having trouble reproducing it in my Windows environment.

@demerphq
Copy link
Collaborator

demerphq commented Dec 9, 2022 via email

@demerphq
Copy link
Collaborator

demerphq commented Dec 9, 2022

Ok, done. It just needed threads.pm updated. You should have been able to see the test failure with make test_porting.

@twata1
Copy link
Contributor Author

twata1 commented Dec 10, 2022

Thank you very much. It is very helpful.

I have just looked at the dist/threads/lib/threads.pm that you have updated for me.
Indeed, I think we should update the version once we fix the module.
I was having trouble with t/porting/cmp_version.t PASSing on my Windows environment without versioning it up, and trying to re-build the blead but the build failed.

Anyway, Thank you for taking care of me!

@demerphq
Copy link
Collaborator

demerphq commented Dec 10, 2022 via email

@demerphq demerphq merged commit d9e3c8d into Perl:blead Dec 10, 2022
@demerphq
Copy link
Collaborator

And merged. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

threads.xs: "implicit declaration of function '_setjmpex'" using MinGW-w64
5 participants