How Do I Check Code Compilation Consistency?

Michael D Stiber stiber at maui.cs.ucla.edu
Wed Oct 11 16:40:09 AEST 1989


We have a rather large software project, in which there are many files
divided among several directories, each directory with its own
Makefile.  Definitions for CFLAGS, etc are made in a main Makefile,
and passed along to subdirectory Makefiles.  The problem is this:
there are several compilation options that one may choose, and we must
be sure that all files are compiled with the same options.  To
complicate things, if different files are compiled with different
options, no obvious errors may result -- the errors are quite likely
to be very subtle, but fatal nonetheless.

To complicate things even further, this project will be used by others
with less knowledge of the inner workings of the code.  They will most
likely be adding their own modules to it.  Any errors introduced by
inconsistent compilation will be very difficult for them to track down
(difficult for us to track down, even).

So, is there any good way to do some sort of consistency checking,
either at link time or run time?  One idea I had was to have a header
file that is included in every source file, which would stick a static
string in the object code that says the file name and the compilation
options that were used.  Then, at run time, the program could grep for
all of those strings in its own object code, and check to make sure
they were consistent.  Is that a good approach?  A stupid, clumsy
approach?  An approach unlikely to be portable from one version of
UNIX to another?  Any better ideas?

I'd really appreciate any pointers or ideas that anyone could give me.
Thanks!!
			    Michael Stiber
   stiber at cs.ucla.edu                  UCLA Computer Science Dept.
   ...{ucbvax,ihpn4}!ucla-cs!stiber    Machine Perception Laboratory
                                 3564 Boelter Hall,Los Angeles, CA 90024



More information about the Comp.unix.wizards mailing list