[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Development
. . -> [Subject]  Fixing up warnings so others can better contribute
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Fixing up warnings so others can better contribute

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1 2  3  4  

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Thu 16 Sep 2010 12:14 AM (UTC)  quote  ]

Amended on Thu 16 Sep 2010 12:15 AM (UTC) by Worstje

Message
I recall (what must by now be a pretty long time ago) that Twisol once started to fix up MUSHclient warnings in recent compilers. But when I spoke to him it came up that Nick apparently never merged any of the fixes he brought up, and by now it would probably be a lost cause given the amount of new versions that have come out.

Since I hope to contribute, I'd like to pick up on that warnings-squashing project, since it is pretty much impossible to see the trees in the forest of warnings that even a partial build tends to throw up.

Thus, my question to Nick is - are you willing to bring such fixes into your master, or did you have some sort of issues with it?

I have zero intention of forking MUSHclient, and if anything 'new' that I code up can't be merged due to me fixing those warnings, it'd be a pretty useless endeavour, so I'd prefer to know before I spend too much time on such a project.

So far, I put up a few branches on github in case any of you want to check out compatibility with VC++6, but it is all trivial thus far.
[Go to top] top

Posted by Nick Gammon   Australia  (19,498 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 16 Sep 2010 12:32 AM (UTC)  quote  ]

Amended on Thu 16 Sep 2010 12:39 AM (UTC) by Nick Gammon

Message
I just don't recall "never merging" any fixes he brought up.

Here are some examples:

http://github.com/nickgammon/mushclient/commit/ff972aec6b
http://github.com/nickgammon/mushclient/commit/1e85109a98
http://github.com/nickgammon/mushclient/commit/5489d89e66
http://github.com/nickgammon/mushclient/commit/91abdc79ff

So this must some other reality, the one where I ignore all suggested changes.

What I *am* resisting is some of the refactoring proposals where functions that currently work, are just being rewritten with a view to making them "nicer". This just involves work in writing, analyzing, testing, and checking.

In fact I had already committed your changes before I read this thread:

http://github.com/nickgammon/mushclient/commit/a9ec61a6efd

However I note that, until you make a change, it now doesn't link for me (I commented on your commit on your branch).

[EDIT] Fixed to remove double-posting of a commit.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #2 on Thu 16 Sep 2010 12:35 AM (UTC)  quote  ]

Amended on Thu 16 Sep 2010 12:39 AM (UTC) by Twisol

Message
Sorry if I wasn't totally clear, Worstje; the problem was that I spent so much time doing warnings mixed with stylistic cleanups, and it was such a mess that Nick really couldn't pull things in like that. It was only worthwhile to just re-fix actual bugs I brought up. And since the warnings are just that - warnings - it wasn't important for him to spend the time plucking these cleanups out of my commit chain.

[EDIT] Nick, you mentioned ff972aec6b twice in that set of links. ;)

[EDIT] And unless I'm quite mistaken, you actually made the 91abdc79ff change; I had simply merged it into my branch, and you later merged my branch into your branch.

http://github.com/nickgammon/mushclient/commit/99c6eea839d641d930e7dcb42633d8670c321b62

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (19,498 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Thu 16 Sep 2010 12:38 AM (UTC)  quote  ]
Message
If you stick to eliminating compiler warnings that would be great, because then when I update the compiler one day, it will work for me too. :)

So that would be appreciated. And of course if in the process of browsing you spot bugs, well I am glad to hear about them too. Twisol has found a few so far, and their fixes are gratefully received and acknowledged.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #4 on Thu 16 Sep 2010 12:39 AM (UTC)  quote  ]
Message
Nick Gammon said:
If you stick to eliminating compiler warnings that would be great, because then when I update the compiler one day, it will work for me too. :)

Did you just say "when"? Wow, there's hope!

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (19,498 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Thu 16 Sep 2010 12:41 AM (UTC)  quote  ]
Message
Twisol said:


Nick, you mentioned ff972aec6b twice in that set of links. ;)

And unless I'm quite mistaken, you actually made the 91abdc79ff change; I had simply merged it into my branch, and you later merged my branch into your branch.



Fixed double posting - I must have gone through the list twice, or in two different ways (I think I searched for Twisol and then your real name).

As for who made the change, it was tagged "Twisol (author)". I think we discussed a while back that this was a bit misleading, but you got the credit.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Reply #6 on Thu 16 Sep 2010 12:54 AM (UTC)  quote  ]
Message
My apologies for my claim of you never merging anything, Nick. I didn't doublecheck against the log of commits done and obviously misunderstood Twisol. :)

And I hadn't spotted that commit yet. Still finding my way on Github, obviously, but glad to see you're more on top than I thought you were. Kudos!

I do intend to stick to fixing compiler warnings only on my vs2010_warnings branch.
[Go to top] top

Posted by Nick Gammon   Australia  (19,498 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Thu 16 Sep 2010 01:03 AM (UTC)  quote  ]
Message
Worstje said:

And I hadn't spotted that commit yet. Still finding my way on Github, obviously, but glad to see you're more on top than I thought you were. Kudos!


Well, only just. :)

I had to fetch and then merge it. Should be faster next time.


My compile gives me:


--------------------Configuration: MUSHclient - Win32 Debug--------------------
Compiling...
globalregistryoptions.cpp
Linking...
nafxcwd.lib(wincore.obj) : error LNK2005: _g_fMultiMonInitDone already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _g_pfnEnumDisplayMonitors already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _g_pfnGetMonitorInfo already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _g_pfnMonitorFromPoint already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _g_pfnMonitorFromRect already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _g_pfnMonitorFromWindow already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _g_pfnGetSystemMetrics already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _InitMultipleMonitorStubs already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _xGetSystemMetrics@4 already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _xMonitorFromPoint@12 already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _xMonitorFromRect@8 already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _xMonitorFromWindow@8 already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _xGetMonitorInfo@8 already defined in winplace.obj
nafxcwd.lib(wincore.obj) : error LNK2005: _xEnumDisplayMonitors@16 already defined in winplace.obj
nafxcwd.lib(wincore.obj) : warning LNK4006: _g_fMultiMonInitDone already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _g_pfnEnumDisplayMonitors already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _g_pfnGetMonitorInfo already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _g_pfnMonitorFromPoint already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _g_pfnMonitorFromRect already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _g_pfnMonitorFromWindow already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _g_pfnGetSystemMetrics already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _InitMultipleMonitorStubs already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _xGetSystemMetrics@4 already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _xMonitorFromPoint@12 already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _xMonitorFromRect@8 already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _xMonitorFromWindow@8 already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _xGetMonitorInfo@8 already defined in winplace.obj; second definition ignored
nafxcwd.lib(wincore.obj) : warning LNK4006: _xEnumDisplayMonitors@16 already defined in winplace.obj; second definition ignored
   Creating library .\WinDebug/MUSHclient.lib and object .\WinDebug/MUSHclient.exp
.\WinDebug/MUSHclient.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

MUSHclient.exe - 15 error(s), 14 warning(s)


If I comment out this line it works:


#define COMPILE_MULTIMON_STUBS


So you need to find a way of making a compiler-version test to put around it. Or I can try to find it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #8 on Thu 16 Sep 2010 01:05 AM (UTC)  quote  ]
Message
Nick, Worstje, what if you replace 'multimon.h' with 'windows.h'? I suggested this in another thread, and it was the solution I used when I first started with the source. Since you both have different windows.h's anyways (I'm pretty sure), I think it should work without too much pain.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (19,498 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Thu 16 Sep 2010 01:06 AM (UTC)  quote  ]
Message
This seems to work for me:


#if _MSC_VER > 1200
  #define COMPILE_MULTIMON_STUBS
#endif 


Now if it works for you too, we can run with that.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,498 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Thu 16 Sep 2010 01:09 AM (UTC)  quote  ]
Message
Twisol said:

Nick, Worstje, what if you replace 'multimon.h' with 'windows.h'? I suggested this in another thread, and it was the solution I used when I first started with the source. Since you both have different windows.h's anyways (I'm pretty sure), I think it should work without too much pain.


Doesn't work.


--------------------Configuration: MUSHclient - Win32 Debug--------------------
Compiling...
winplace.cpp
C:\source\mushclient\winplace.cpp(46) : error C2065: 'HMONITOR' : undeclared identifier
C:\source\mushclient\winplace.cpp(46) : error C2146: syntax error : missing ';' before identifier 'hMonitor'
C:\source\mushclient\winplace.cpp(46) : error C2065: 'hMonitor' : undeclared identifier
C:\source\mushclient\winplace.cpp(47) : error C2065: 'MONITORINFO' : undeclared identifier
C:\source\mushclient\winplace.cpp(47) : error C2146: syntax error : missing ';' before identifier 'mi'
C:\source\mushclient\winplace.cpp(47) : error C2065: 'mi' : undeclared identifier
C:\source\mushclient\winplace.cpp(52) : error C2065: 'MonitorFromRect' : undeclared identifier
C:\source\mushclient\winplace.cpp(52) : error C2065: 'MONITOR_DEFAULTTONEAREST' : undeclared identifier
C:\source\mushclient\winplace.cpp(57) : error C2228: left of '.cbSize' must have class/struct/union type
C:\source\mushclient\winplace.cpp(58) : error C2065: 'GetMonitorInfo' : undeclared identifier
C:\source\mushclient\winplace.cpp(60) : error C2228: left of '.rcWork' must have class/struct/union type
Error executing cl.exe.

winplace.obj - 11 error(s), 0 warning(s)


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #11 on Thu 16 Sep 2010 01:17 AM (UTC)  quote  ]
Message
Nick Gammon said:
Doesn't work.

--------------------Configuration: MUSHclient - Win32 Debug--------------------
Compiling...
winplace.cpp
C:\source\mushclient\winplace.cpp(46) : error C2065: 'HMONITOR' : undeclared identifier
C:\source\mushclient\winplace.cpp(46) : error C2146: syntax error : missing ';' before identifier 'hMonitor'
C:\source\mushclient\winplace.cpp(46) : error C2065: 'hMonitor' : undeclared identifier
C:\source\mushclient\winplace.cpp(47) : error C2065: 'MONITORINFO' : undeclared identifier
C:\source\mushclient\winplace.cpp(47) : error C2146: syntax error : missing ';' before identifier 'mi'
C:\source\mushclient\winplace.cpp(47) : error C2065: 'mi' : undeclared identifier
C:\source\mushclient\winplace.cpp(52) : error C2065: 'MonitorFromRect' : undeclared identifier
C:\source\mushclient\winplace.cpp(52) : error C2065: 'MONITOR_DEFAULTTONEAREST' : undeclared identifier
C:\source\mushclient\winplace.cpp(57) : error C2228: left of '.cbSize' must have class/struct/union type
C:\source\mushclient\winplace.cpp(58) : error C2065: 'GetMonitorInfo' : undeclared identifier
C:\source\mushclient\winplace.cpp(60) : error C2228: left of '.rcWork' must have class/struct/union type
Error executing cl.exe.

winplace.obj - 11 error(s), 0 warning(s)


...Bizzare. The MSDN docs for MonitorFromRect (for example) say to include windows.h. Maybe it's just because you're using VC6. Guess we'll have to go with the version #if...

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Reply #12 on Thu 16 Sep 2010 01:18 AM (UTC)  quote  ]
Message
Heh, I'm too slow around here. Seems we found the same fix (be it written a bit differently). Already sent you a pull request, not sure which version is better. Upto you. :)
[Go to top] top

Posted by Nick Gammon   Australia  (19,498 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Thu 16 Sep 2010 01:48 AM (UTC)  quote  ]
Message
That seems to have worked. This is how I grabbed your stuff BTW:


# pull your stuff
git fetch http://github.com/worstje/mushclient.git vs2010_fixes

# merge this commit
git merge 08361f312f14f88ff97c

# compare to previous version of MUSHclient
git diff v4.61 -- winplace.cpp

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,498 posts)  [Biography] bio   Forum Administrator
Date Reply #14 on Thu 16 Sep 2010 01:51 AM (UTC)  quote  ]

Amended on Thu 16 Sep 2010 01:54 AM (UTC) by Nick Gammon

Message
With some of these warnings (fixes):


//----------------------------------------
//  world.BlendPixel
//----------------------------------------
static int L_BlendPixel (lua_State *L)
  {
  CMUSHclientDoc *pDoc = doc (L);
  lua_pushnumber (L, pDoc->BlendPixel (
            (long) my_checknumber (L, 1),    // Blend
            (long) my_checknumber (L, 2),    // Base
            (short) my_checknumber (L, 3),    // Mode
            my_optnumber (L, 4, 1)    // Opacity
            ));
  return 1;  // number of result fields
  } // end of L_BlendPixel



Can't you just #pragma them away? Don't you think the resulting code looks ugly? And I am a bit averse to having casts everywhere, they can hide other problems.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,074 views.

This is page 1, subject is 4 pages long: 1 2  3  4  [Next page]

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]