[Ns-developers] build fixes for gcc 4.0.1
Mathieu.Lacage at sophia.inria.fr
Tue Jul 19 04:43:45 PDT 2005
The following patch-sets fix the -Wall -Werror build with gcc 4.0.1.
some are just annoying warnings. Others are obviously bugs (mostly patch
9). I tested the warning-free nature with -g -O0. I am working on the
warnings with -O3 but that is taking some time because the fixes are
getting really tricky.
I) ns2 stuff
patch 8 fixes the "virtual class without virtual destructor" warning in
a lot of classes. This warning is not very dangerous in ns-2 since ns-2
never performs the destruction of the simulation network but I have yet
to meet a programmer who can justify not declaring and implementing a
virtual destructor in a class which has virtual methods :)
patch 9 fixes some very nasty errors with regard to the order of
evaluation of sub-expressions in expressions. In certain cases, the
result of the evaluation was obviously not what was intended and was
undefined per the C++ standard (which means, at best, weird results).
patch 10 contains a bunch of various fixes for signed/unsigned
confusion, some wrong arguments to printf (typically, %ld requires a
long int argument and not an int) and various other less serious
patch 11 contains a single fix for a segfault I noticed while running
the validation teste suite after applying my patches. I have no idea why
the segfault started happening after my patches and not before but it is
indeed pretty ugly.
Of course, I ran the validation test suite and everything validates ok.
II) tclcl stuff
patch 0 contains the single bug fix needed to compile ns-2. This patch
is against a header which is installed by tclcl and used by ns-2.
After getting ns-2 to compile with gcc-4.0.1, I thought I should fix
tclcl. To do this, I had to hack the autoconf stuff because it was
obviously broken and was not recognizing my system configuration and
thus was generating very weird compilation errors.
patch 1 contains a few fixes against the m4 code from the conf directory
to be able to use them with a recent autoconf. I have no idea where the
original version of these files comes from: these patches should be
propagated to the canonical location of the files. For example, there is
a copy of the files in ns-2 and my patch could be applied to them too.
Of course, I noticed that the two versions of the files are different
(that is, the ns-2 version was updated without updating the tclcl
version) but I expected it (sharing code by keeping separate copies of
the same files always end-up in diverging codebases).
patch 2 contains fixes to:
- generate the config.h file from the config.h.in file.
- use the config.h file from various places in the code where it was
After applying these 3 patches, you need to:
- run autoheader to re-generate a proper config.h.in file (since this
file is automatically generated, it should not be added to the cvs
repository but should be included in the released tarballs)
- run autoconf to re-generate the configure script from configure.in.
Running configure now generates the config.h file from the config.h.in
file and from the result of the configuration. A look at config.h will
convince you that it indeed, contains all the definitions for the
Should I forward these patches to a tclcl mailing-list ?
More information about the Ns-developers