Login
User Name:

Password:



Register

Forgot your password?
Hi - Clean SmaugFuss map/description issue..
Dec 15, 2024 7:29 pm
By Samson
AFKMud 2.2.4
Dec 10, 2024 4:09 pm
By Samson
I3 and IMC
Dec 8, 2024 6:35 pm
By Remcon
Ubuntu 22.04.5 LTS
Dec 5, 2024 5:10 pm
By Remcon
SmaugFUSS 1.8/1.9
Nov 29, 2024 11:46 am
By Remcon
SWFOTEFUSS 1.5.1
Author: Various
Submitted by: Samson
SWRFUSS 1.4.1
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.5
Author: Various
Submitted by: Samson
AFKMud 2.2.4
Author: AFKMud Team
Submitted by: Samson
LOP 1.5
Author: Remcon
Submitted by: Remcon
Users Online
Bing, AhrefsBot

Members: 0
Guests: 45
Stats
Files
Topics
Posts
Members
Newest Member
494
3,808
19,707
588
Mortrex

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » General » General Discussions » How do we handle the errors c...
Forum Rules | Mark all | Recent Posts
How do we handle the errors caused by gcc4.2? (14 Votes)
Update to const char *argument and adjust all the rest of the code accordingly.  57.14% - 8 votes

Modernize and update to std::string throughout the code.  42.86% - 6 votes

Other. (Post an explanation of your alternative solution.)  0% - 0 votes

How do we handle the errors caused by gcc4.2?
< Newer Topic :: Older Topic >

Pages:<< prev ... 4, 5, 6, 7, 8 next >>
Post is unread #141 Sep 1, 2008 6:45 pm   
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

 
Quixadhal said:

Good luck on the upgrade Conner! Hardware sucks. :)

Thanks, currently it's trying hard to suck even worse than it should be and I'm not sure if the problem is actually in-house. *mutter*

Quixadhal said:

gcc 4.x checks for a great many things, in terms of code usage, that gcc 3.x didn't even try to check.

Actually, I'd take that a step further and posit that there are significant differences even between gcc 4.1.x and 4.2.x since my mud, in it's present state, compiles just fine under gcc 4.1.3 but will not compile under 4.2.3 because of complaints about stdarg.h (and I've got flags in my Makefile to stop on errors so that's the only complaint I know of because it won't go beyond that one...)

Quixadhal said:

I think people who are already here, and already use Smaug, will be able to adapt to changes as they come along. I don't want to abandon folks on older systems either, but I also don't want to see things stall out because too much energy is being devoted to keeping things running on the older systems.

It might be as simple as putting some comments in the Makefile on ways to get things running with older compilers. "If you're using gcc 3.x, disable these warnings. If you're in FreeBSD, do this. In ALL cases, be aware that things might be broken if you do this."

I'd be inclined to agree entirely with this but I have to ask if it really would be as simple as a line or two of commented out instructions? (Even just per compiler/OS?)

Post is unread #142 Sep 1, 2008 7:20 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,697
JoinedJan 1, 2002

 
There are some minor things that are as easy as putting in a toggle flag in the Makefile. That's how the Cygwin support works for one. Toggle a flag, the code compiles extra stuff it wouldn't do otherwise.

The problem comes when the difference between compilers creates a situation as completely insane as the const fix. That's not something you can correct with a simple flag. To fix that you really do need to go down into the dirty levels of the code and bring it up to speed the hard way. One error at a time.

Post is unread #143 Sep 1, 2008 9:51 pm   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
Oh, I didn't mean a single flag would FIX the problem. Rather, it would allow people to compile things and ignore the various warnings AT THEIR OWN RISK.

Personally, I'd rather have things error and fail at compile time, than risk crashes at run time. However, if all you're doing is downloading the MUD to see if you like it, getting it to work is probably more important than making sure it's 100% stable. That's why I'd put things like that in comments. If you understand the risk, and you're OK with it, here's how to get it to run until you can upgrade, or we can find a way to help you fix it for your particular environment.

Post is unread #144 Sep 14, 2008 9:58 am   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
Just as an amusing "proof" of why turning off warnings is a bad idea..... Here's a bug I JUST fixed from my old mud, which has been there since 1995.

WileyMUD was written before Smaug existed, and so all the spell code is usually cut and pasted from one spell to another (no generic spell_smaug yet). Well, there are both spell_blah() routines to do the actual spell, and cast_blah() routines as the API to cast the spell. When you call cast_, it checks to see how the spell is being invoked, as in cast as a spell, read from a scroll, etc... so there's a case statement for that.

With that as background, this will make sense:
void cast_weakness(char level, struct char_data *ch, char *arg, int type,
                   struct char_data *victim, struct obj_data *tar_obj)
{
  if (DEBUG > 1)
    dlog("called %s with %d, %s, %s, %d, %s, %s", __PRETTY_FUNCTION__, level, SAFE_NAME(ch), VNULL(arg), type, SAFE_NAME(victim), SAFE_ONAME(tar_obj));

  switch (type) {
    case SPELL_TYPE_SPELL:
      spell_weakness(level, ch, victim, 0);
      break;
    case SPELL_TYPE_POTION:
      spell_weakness(level, ch, ch, 0);
      break;
    case SPELL_TYPE_SCROLL:
      if (tar_obj)
        return;
      if (!victim)
        victim = ch;
      spell_weakness(level, ch, victim, 0);
      break;
    case SPELL_TYPE_STAFF:
      for (victim = real_roomp(ch->in_room)->people; victim; victim = victim->next_in_room)

==>     if (!in_group) <==
          spell_weakness(level, ch, victim, 0);

      break;
    default:
      bug("Serious screw-up in weakness!");
      break;
  }
}


I was recompiling to see how many things had broken due to gcc upgrades over the last year or so, and gcc 4.1.2 spat this warning out at me today:
spells.c: In function 'cast_weakness':
spells.c:2768: warning: the address of 'in_group', will always evaluate as 'true'


The line that I highlighted should have read:
 if(!in_group(victim, ch)) 


SO... IF someone had actually tried to use a staff which had the weakness spell associated with it, the game would not have crashed, but the spell would not actually have been cast on anyone, since it would have spun through the loop of people in the room and decided they were ALL in the caster's group.

Warnings are good.

Even the annoying "use of sigsetmask() is depreciated, go learn another API old fart!" one.

Post is unread #145 Sep 15, 2008 1:27 pm   
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

 
I don't think anyone here was suggesting to turn off warnings.

Personally I was talking about not handling warnings as errors.

Post is unread #146 Sep 16, 2008 6:25 am   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
True, although part of the reason I treat all warnings as errors is that it forces me to go fix them.

On the occasion I find one I don't want/need to fix right away (the sigsetmask one, for example), I'll remove the -Werror flag to get a build done, but I put it back so I don't just forget about it.

When I tried recompiling with the newer gcc (4.1.2), I got about 35 new warnings, and so it wasn't hard to spot that error. Other codebases I've looked at have had, literally, hundreds of warnings. Enough that critical errors would just get buried in the flood.

I guess I tend to think that either people already plan to fix every warning, in which case it doesn' t matter if they're errors or not... or they intend to only fix the things they have to, in which case errors like the one I had above would slip through the cracks.

Post is unread #147 Sep 16, 2008 11:13 am   
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

 
I eventually fix all warnings, where eventually is in the not-too-distant future. I know which warnings are actually important and which I can get away with putting off for a while. Sometimes I think it's more important to just press ahead, in which case I really don't want warnings treated as errors. I never use the flag because I would have to keep turning it on and off; that would get on my nerves pretty quickly. Basically I am my own -Werror flag -- I allow minor warnings in the short term (important warnings always get fixed), especially during development, but I fix them when I go to production. :smile:

Post is unread #148 Sep 16, 2008 1:46 pm   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006

 
I really don't get why this discussion about the -Werror flag is still going on.. the packages are shipping with the -Werror flag enabled.. If you don't want it on.. delete it from the makefile when you download it..

Post is unread #149 Sep 16, 2008 1:56 pm   
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

 
I think people were talking about how they do their own development. The flag is only relevant in FUSS when we run into one of the issues like we did for this time around. :wink:

Post is unread #150 Sep 16, 2008 2:12 pm   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006

 
Oh, my bad. I thought we were still rating about how warnings as errors are the devil.

Post is unread #151 Sep 17, 2008 7:00 am   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
lint main.c
if [ "$?" -ne 0 ]; then
  echo "Blaspheme!  Thy code is not PERFECT in the eyes of lint!"
  rm -f main.c
fi


*grin*

Pages:<< prev ... 4, 5, 6, 7, 8 next >>