[Patch] Fixed misleading indentation above GCC 6.x.x

Discussion of development and patch submission.
Post Reply
basic2004
Posts: 124
Joined: Sun 08 Jan, 2017 5:59 pm

[Patch] Fixed misleading indentation above GCC 6.x.x

Post by basic2004 »

Fixed errors when compiling with GCC 6.x.x, this makefile included -Wall argument.
modified from latest sources.
pcem-3cc3d67-fix-misleading-indentation.patch
(8.49 KiB) Downloaded 429 times
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [Patch] Fixed misleading indentation above GCC 6.x.x

Post by Battler »

I'm going to make a patch defines two variables that I can MAKE with, one of which will control the NT DDK header mess (so you can compile PCem in a MSys2 environment), and the other will control the OpenAL libraries (-lopenal32 vs. -lopenal -lopenal.dll). That way I can finally compile PCem without having to modify the code every time I hg clone. :p
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

Re: [Patch] Fixed misleading indentation above GCC 6.x.x

Post by JosepMa »

@Battler: as for the NT DDK, I changed the _MINGW64 #ifdef to __MINGW32__ and that worked for me. (msys2). ( __MINGW64__ is only defined when building for 64bits )


About the linker libraries, supposedly, we should be using wx-config --libs , sdl-config --libs (or sdl2-config --libs), and I thought there was an openal-config , but I don't see it on my msys2.
But maybe using directly pkg-config would do it:

Code: Select all

$ pkg-config.exe --libs openal
-LD:/msys64/mingw32/lib -lopenal
I tested that on ubuntu and debian too.
basic2004
Posts: 124
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Patch] Fixed misleading indentation above GCC 6.x.x

Post by basic2004 »

JosepMa wrote:@Battler: as for the NT DDK, I changed the _MINGW64 #ifdef to __MINGW32__ and that worked for me. (msys2). ( __MINGW64__ is only defined when building for 64bits )


About the linker libraries, supposedly, we should be using wx-config --libs , sdl-config --libs (or sdl2-config --libs), and I thought there was an openal-config , but I don't see it on my msys2.
But maybe using directly pkg-config would do it:

Code: Select all

$ pkg-config.exe --libs openal
-LD:/msys64/mingw32/lib -lopenal
I tested that on ubuntu and debian too.
I saw you already fixed misleading indentation, but vid_voodoo_codegen_x86-64.h should be modified like vid_voodoo_codegen_x86.h.
I'll challange MSYS2 with GCC 7.1.0 soon. and try to compile x86-64.
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

Re: [Patch] Fixed misleading indentation above GCC 6.x.x

Post by JosepMa »

Yeah.. I am not compiling in 64bits with mingw, even though I have it installed.
Basically, I had read that the 64bits one was less stable (especially the voodoo part) and had a few random issues when building on linux 64bits, so when I finally got msys2 to compile, i simply stayed with 32bits.

Btw... If we are serious about making changes for mingw compilation, I would really like to make autoconf to work. The current makefile is so simple that everytime that I change the sound_emu8k.h header, I have to rebuild everything, since it does not realize that it has to rebuild sound.o too.
If i don't do that, i have issues ranging from sound noises to emulated program hangs. (hopefully it is that obvious so I just rebuild and relaunch)
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [Patch] Fixed misleading indentation above GCC 6.x.x

Post by Battler »

This is a GCC/GNU Make problem - it does not keep a list of which files use which headers. OpenWatcom, for example, does, so whenever I change a header, it automatically recompiles every single file that includes it. I think so does Visual Studio. There is a way around it, though, by listing which .o file uses which .h file in the makefile, however that list then has to be manually maintained.

- basic2004: PCem compiles fine with MSys2 and GCC 7.1.0, I do that these days, it just needs the same changes it needs for GCC 6.3.0.
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [Patch] Fixed misleading indentation above GCC 6.x.x

Post by SarahWalker »

Committed at rev 820.
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

Re: [Patch] Fixed misleading indentation above GCC 6.x.x

Post by JosepMa »

Battler wrote:This is a GCC/GNU Make problem - it does not keep a list of which files use which headers. OpenWatcom, for example, does, so whenever I change a header, it automatically recompiles every single file that includes it. I think so does Visual Studio. There is a way around it, though, by listing which .o file uses which .h file in the makefile, however that list then has to be manually maintained.
Try it on linux with the generated Makefile. You will see that it knows it has to build sound_emu8k.c AND sound_sb.c (sorry, i said sound.o before).
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [Patch] Fixed misleading indentation above GCC 6.x.x

Post by Battler »

Then it's the Windows port that leaves a lot to be desired.
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

Re: [Patch] Fixed misleading indentation above GCC 6.x.x

Post by JosepMa »

No. The Makefile that autoconf generates for the sources is sized 350KB. Compared to 4KB of the manually created one. (ok, generally these files have many unnecessary things but still..)
But the important part is that a subdir ".deps" is generated with some files with a .To extension that have the dependencies of each file. That's how it works. (I don't have much experience with autoconf, so I cannot comment on the innerworkings of these files)
Post Reply