cons-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: System includes


From: Alex Jacques
Subject: RE: System includes
Date: Wed, 16 Jan 2002 13:37:24 -0500

I'm not sure that the previous 2 suggestions make sense in the context of
your problem.
I think that Wayne's and Steve's statement that Cons scans for both

#include "myheader.h"

and

#include <myheader.h>

is correct (the one distinction being that angles don't cause the PWD to be
scanned unless '.' is explicitly in CPPPATH, which is the same behavior as C
compilers).

However, I don't understand why you would have to include "real" system
header paths in your CPPPATH. By real I mean /usr/include or whatever, as
opposed to directories in your project that contain header files which you
include via

#include <myheader.h>

Let's say that you have a project structure like

myproject/
myproject/Construct
myproject/myinclude/
myproject/myinclude/myheader.H
myproject/mysource/
myproject/mysource/myprogram.C

and in myproject/mysource/myprogram.C you have

#include <stdio.h>
#include <myheader.H>

and in myproject/Construct you have

$env = new cons(CPPPATH => 'myinclude');

everything should work fine. Cons should find myheader.H in your CPPPATH.
However it won't find stdio.h, and so will silently ignore it. In practice
ignoring headers it doesn't find shouldn't be a real problem. If you forget
to put one of your directories in CPPPATH Cons will not do a proper
dependency check, but you should be able to figure out the problem when your
compiler complains about not being able to find some of your headers (since
CPPPATH is also used to add compiler switches like -I myinclude).

I can think of a few possible explanations for your problem.

1. I don't understand your problem, and you actually do want to do a
dependency check on things like /usr/include/stdio.h. You certainly can if
you wish, although it shouldn't be necessary unless you're changing those
files on a regular basis. The extra dependency checks will slow down Cons
however (see the SourceSignature method in Cons 2.3.0 or later for ways to
fix that up by using timestamps instead of MD5 signatures).

2. You're not setting CPPPATH correctly. This is a common problem. You must
set it in the argument list of the constructor, as shown above. You should
not change it after that.

3. You were simply unclear about what Cons means by the distinction between
user and system includes (this could definitely be explained better in the
manual), and were concerned that it wouldn't work with your coding
conventions. If you experiment to assure yourself, remember that the
traditional "touch" command won't affect Cons' behavior if you're using the
default MD5 signature calculations.

4. Something else.

Even if you've solved your problem and I've just been prattling on, please
respond. On first thought I believed that you had found a serious flaw in
the Cons dependency checking technique, and I just want to make sure that
you haven't.

P.S. What version of Cons and Perl, and what OS and compiler are you using?

> -----Original Message-----
> From: address@hidden [mailto:address@hidden
> Behalf Of address@hidden
> Sent: Wednesday, January 16, 2002 8:12 AM
> To: address@hidden
> Subject: System includes
>
>
> Hi,
>
> I've been trying cons again (the latest version of ActivePerl
> contains Digest::MD5 by default, so I can finally use cons on
> Windows at work) and I hit trouble: for the purpose of
> dependency analysis, cons doesn't consider "system" includes
> (i.e. directives with angle brackets, of the form
> #include <file.H>
> ). I can't even say if the behavior is intended - docs don't
> really describe what "complete dependency analysis" is and
> the cons source doesn't make much sense to me - but I can't
> tolerate it. Ignoring system includes is IMHO a reasonable
> default, but for me it's a show-stopper, because our C++ coding
> standards prescribe using angle brackets in *all* includes
> (don't ask me why - I have no idea), and even if I wanted to
> scratch the rule (which I doubt is practically possible), I
> can't ignore all the existing code following it. I can patch
> cons to treat all includes as if they used quotes (I did), but
> I wanted to ask:
> Is cons supposed to always skip system includes?
> If yes, is it possible to make this behavior optional?
>
>   Bye
>     Vasek
>
> _______________________________________________
> address@hidden
> http://mail.gnu.org/mailman/listinfo/cons-discuss
> Cons URL: http://www.dsmit.com/cons/
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]