[Info-vax] C compiler snag

Craig A. Berry craigberry at nospam.mac.com
Wed May 19 14:30:05 EDT 2021


On 5/19/21 7:46 AM, David Jones wrote:
> On Wednesday, May 19, 2021 at 7:57:10 AM UTC-4, Craig A. Berry wrote:
> 
>> Have you tried specifying the current working directory in Unix format
>> on the command line:
>> cc/include="./" humpf.c

Nope, that doesn't work.

> I replicated the problem, and got it work with
>     cc/include="./incl" humpf.c

That works for this made-up case but may not be general enough.  It also
works because ./incl/../something.h is the same as ./something.h, and
the grandchild may not always be in the same location as the
grandparent.  You could specify any subdirectory, even a nonexistent
one, and the result would be the same.  For example, this works:

$ cc/include="./nosuchdir" humpf

A bit of poking with SET WATCH FILE/CLASS=ALL and DFU shows that the
first place the compiler looks for something.h when no include
directories are specified explicitly is the parent directory one level
up from where humpf.c is located.  The next place it looks is relative
to the POSIX root but at that point it's already given up on finding it
relative to the program being compiled.

So the compiler is honoring the relative portion of the path, but it is
considering it relative to the grandparent .c file or the current
working directory of the compile operation (which are the same in this
case) and *not* relative to the file containing the #include directive
(h.h).

Whether this is a bug or a feature I don't know.  But it is definitely
different from what other compilers do.

> Specifying various values of /nest_include made no difference.
> 

P.S. DFU was necessary because SET WATCH FILE gives you only the FID,
not the name, of the directory in a "Read only directory access"
message. So you have to take a message like this:

%XQP, Thread #0, Read only directory access (15599,12,0)

and find out what it is with:

$ mcr dfu search/fid=15599 dka7:

      Disk and File Utilities for OpenVMS V3.2
%DFU-I-SEARCH, Start search on DKA7: ($2$DKA7:)

$2$DKA7:[000000]PSX$ROOT.DIR;1 
                       1/16

%DFU-I-EOF, End of file INDEXF.SYS, Primary headers : 1

%DFU-S-FND , Files found : 1, Size : 1/16



More information about the Info-vax mailing list