--------------------Configuration: openttd - Win32 Release--------------------
Compiling...
ai.c
C:\$games\#ottd_source\ai\ai_event.h(23) : warning C4096: '__cdecl' must be used with '...'
dedicated_v.c
null_v.c
win32_v.c
Generating Code...
Compiling...
build.c
trolly.c
default.c
pathfinder.c
Generating Code...
Compiling...
airport.c
command.c
console.c
console_cmds.c
currency.c
depot.c
economy.c
engine.c
fileio.c
gfx.c
gfxinit.c
landscape.c
misc.c
network.c
newgrf.c
npf.c
oldloader.c
openttd.c
pathfind.c
pbs.c
Generating Code...
Compiling...
players.c
saveload.c
screenshot.c
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\zlib.h(1122) : warning C4096: '__cdecl' must be used with '...'
settings.c
signs.c
sound.c
sprite.c
strings.c
texteff.c
vehicle.c
vehicle_gui.c
viewport.c
waypoint.c
widget.c
win32.c
window.c
aircraft_gui.c
airport_gui.c
bridge_gui.c
dock_gui.c
Generating Code...
Compiling...
engine_gui.c
graph_gui.c
industry_gui.c
intro_gui.c
main_gui.c
misc_gui.c
music_gui.c
network_gui.c
news_gui.c
order_gui.c
player_gui.c
rail_gui.c
road_gui.c
roadveh_gui.c
settings_gui.c
ship_gui.c
smallmap_gui.c
station_gui.c
subsidy_gui.c
terraform_gui.c
Generating Code...
Compiling...
town_gui.c
train_gui.c
aircraft_cmd.c
clear_cmd.c
disaster_cmd.c
dummy_land.c
industry_cmd.c
misc_cmd.c
order_cmd.c
C:\$games\#ottd_source\ai/ai_event.h(25) : warning C4096: '__cdecl' must be used with '...'
rail_cmd.c
road_cmd.c
C:\$games\#ottd_source\ai/ai_event.h(25) : warning C4096: '__cdecl' must be used with '...'
roadveh_cmd.c
C:\$games\#ottd_source\ai/ai_event.h(25) : warning C4096: '__cdecl' must be used with '...'
ship_cmd.c
station_cmd.c
C:\$games\#ottd_source\ai/ai_event.h(25) : warning C4096: '__cdecl' must be used with '...'
town_cmd.c
train_cmd.c
tree_cmd.c
tunnelbridge_cmd.c
unmovable_cmd.c
water_cmd.c
Generating Code...
Compiling...
network_client.c
network_data.c
network_server.c
network_udp.c
Generating Code...
Linking...
openttd.exe - 0 error(s), 6 warning(s)
The error with zlib.h has always been there on my system but as everything kept working okay i didn't mind. But lately there was a new file added to the /trunk/ called 'ai_event.h' and when I compile again I get 5 more errors.
And they are all the same:
warning C4096: '__cdecl'
I could shrink my post a bit a only keep the relevant parts? Just let me know developers!
# Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)
I use MSVC++ 6 myself and get the same six warnings. I found some info on the exact warning, but unfortunately I don't really have enough experience yet myself to figure out exactly what to do with it.
A computer scientist is someone who, when told to "Go to Hell," sees the "go to," rather than the destination, as harmful.
I would be happy to help, but it's windows related (I don't get it) and I have no idea what it means. Since it's a warning you should just try to ahead and see if it works. Since it works for the other platforms, odds are that it will work. Some warnings are critical and some are not important. Say for instance "mixed declaration and statements". That one works on gcc, but will produce an error on the MS compiler. If you are only building something for yourself and you are using gcc, it's not important. However it IS important if you plan to commit the code
Bjarni wrote:I would be happy to help, but it's windows related (I don't get it) and I have no idea what it means. Since it's a warning you should just try to ahead and see if it works. Since it works for the other platforms, odds are that it will work. Some warnings are critical and some are not important. Say for instance "mixed declaration and statements". That one works on gcc, but will produce an error on the MS compiler. If you are only building something for yourself and you are using gcc, it's not important. However it IS important if you plan to commit the code
yeah, and what if I had 1734 warnings of these instead of 6 right now and I still links the programm without any error?
I mean... isn't it possible to make it compile WITHOUT those warnings?
# Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)
webfreakz.nl wrote:I mean... isn't it possible to make it compile WITHOUT those warnings?
it's always possible to compile without warnings, you just use a flag to tell it not to show warnings
To actually removing the cause of the warning, you will need to figure out why it's there. Try searching for that warning on google or something. That helped me to figure out the cause of a weird error once. Most often you are not the first one on earth to get a certain problem
I had a look at it and changed a few things and the warnings are gone atleast. The question is ofcourse whether this code will still compile correctly on other platforms and in other compilers. So if anyone feels a calling to test it, then go ahead
P.S. Does anyone know a way to only add certain files to a patch with TortoiseSVN? When I created this patch, I had to manually edit out any other changes I've made to the source, which might get annoying in the long run.
first of all, you should NEVER edit a diff file by hand. Odds are that it's not possible to apply (I think that is the case with this one). You could do as the rest of us do: have more than one copy of the source
As for the fix, I wonder about making it more like
This way it will use it for the compiler that needs it while it will not be defined as a string anywhere else and it will be replaced with an empty space
After editing it I tested it again and it seemed to work fine, but that might have just been because the patcher I use is more lenient than others so I'll make sure I make the changes in a clean checkout next time. Can I assume that the diff file didn't work for you based on your "I think that is the case with this one"?
Your suggestion has its merits, though I'm not sure whether it's really needed. As far as I can tell, functions with variable parameter-lists need to use the __cdecl calling convention. I think this holds for just about any C++ compiler, only most of them just do it implicitly, so it shouldn't harm anything to make it explicit instead.
A computer scientist is someone who, when told to "Go to Hell," sees the "go to," rather than the destination, as harmful.
Graphite wrote:I think this holds for just about any C++ compiler, only most of them just do it implicitly, so it shouldn't harm anything to make it explicit instead.
TrueLight:"Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?" <@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Whoops... so it is... I've looked around the net and __cdecl seems to be a standard element of the C language though, so my earlier words should still hold.
I think that in general it's preferable to solve a problem in a simple uniform way (i.e. make the __cdecl explicit for all cases) than to solve it in a case-specific way (add it only for the win-version), since the code doesn't end up cluttered with case-specific code. It all depends on whether adding the __cdecl to the offending statements works on all platforms though. If not, then obviously the case distinction would have to be made to get rid of the warnings.
Darkvater wrote:A horrible patch.
Ah... that was posted while I was typing this. Could you explain why it is a horrible patch so that I may learn how to do better in the future? Constructive criticism is always more helpful than remarks like this...
A computer scientist is someone who, when told to "Go to Hell," sees the "go to," rather than the destination, as harmful.
There is already a CDECL for MS compilers which we have added. Bjarni could've been more thorough as well, but his WIN_CDECL was on the right track.
I have added the ZLIB_WINAPI to stdafx.h cause stupid VS6 compiles when compiling screenshot.c (PNG) as well which links implicitely with zlib.
TrueLight:"Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?" <@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
No fair... you put up revision 3236 after posting the message
Anyhow... I wasn't aware that there was already a CDECL declared. Probably because I'm still trying to get a feel for the complete openTTD code. It really would've helped if you had said that earlier though instead of just that it's horrible. The warnings are gone atleast, so in the end all is well
A computer scientist is someone who, when told to "Go to Hell," sees the "go to," rather than the destination, as harmful.
Darkvater wrote:There is already a CDECL for MS compilers which we have added. Bjarni could've been more thorough as well, but his WIN_CDECL was on the right track.
never really cared for the windows specific code and it shows. I just read the diff and changed it to something that I could live with. I didn't actually open the source code to check this and I would not commit this one either as I know I'm not the windows guru