| Yes, this is correct behavior.
And yes, the behavior has changed,
there are some other notes in this notes
file which explain some of the history
if you are interested.
5.2.2 Inclusion Using Quotation Marks
The second form of the #includepreprocessor directive uses
quotation marks to delimit the file specification:
#include " file-spec "
The file-spec is a valid OpenVMS or UNIX style file specifi-
cation.
For this form of file inclusion, the compiler searches directo-
ries in the following order for the file to be included:
1. One of the following directories:
� If /NESTED_INCLUDE_DIRECTORY=INCLUDE_
FILE (the default) is specified, the directory where the
immediately containing include file is located (that is,
the directory containing the file in which the #include
directive occurred).
� If /NESTED_INCLUDE_DIRECTORY=PRIMARY_
FILE is specified, the directory containing the top-
level source file (that is, the directory containing the
.C file being compiled, which is not necessarily the
current default directory). This is most similar to the
behavior of the VAX C compiler.
� If /NESTED_INCLUDE_DIRECTORY=NONE is
specified, then skip this step and begin at step 2.
--val
|
| I've read .0 a bit and also 1657, but even 1657 omits
details I think affect the problem I'm seeing
that is related to .0. Briefly, CC includes the wrong
header file; I can't understand why.
This behavior is the same, whether the compiler is
DEC C V5.2-003 on OpenVMS Alpha V6.2-1H2 or
DEC C V5.5-002 on OpenVMS Alpha E7.1.
MMSRC$ is defined to be SRC$,REF$
REQ$ is defined to be SRC$,REF$
A header file I have just modified lives in SRC$, with
an earlier version in REF$. One of the includers of
this file (most, in fact) lives in REF$. The CC command
line is
CC /NOLIST/DEBUG/noopt/inc=(req$,cad$root:[cadrtl])/PREFIX=ALL/DEFINE=
(__VMS_VER=60100000)/WARN=DISABLE=MACROREDEF /OBJ=OBJ$:CLEO_UTILITIES.OBJ
MMSRC$:CLEO_UTILITIES.C
The file in question includes the header file as follows.
#include "cleodef.h"
I do not consider this to be a nested include, yet adding
the qualifier /NEST=NONE affects which version of CLEODEF.H is
included. If I read the docs carefully, /NEST appears to be
speaking about what happens when a header file includes
another header file, and should presumably not apply to
the mechanism of how the top-level header files are located.
I guess I'm getting confused by part of the behavior that
Maurizio Sichera in 1657.0 described as
else if (file_exists_in_the_directory_of_the_source) /* [1] */
The directory of the source, to me, is MMSRC$ (the search list
logical name), not REF$ (the actual directory containing the file).
Yes, there's a header file MMSRC$:CLEODEF.H, and it's in SRC$, not REF$.
So, some questions are:
1. Why with both 5.2 and 5.5 compilers is the REF$:CLEODEF.H
file included instead of SRC$: ? Does the compiler consider
the directory_containing_the_source to be REF$ instead of MMSRC$ ?
2. Why does /NEST=NONE affect this behavior, when there's only
one level of inclusion going on here?
Sam
|
| > 1. Why with both 5.2 and 5.5 compilers is the REF$:CLEODEF.H
> file included instead of SRC$: ? Does the compiler consider
> the directory_containing_the_source to be REF$ instead of MMSRC$ ?
Yes, exactly. The compiler looks in the actual directory (whatever
REF$ translates to), regardless of the search list that was used
to find it.
> 2. Why does /NEST=NONE affect this behavior, when there's only
> one level of inclusion going on here?
Perhaps the qualifier has a confusing name. It affects where the
compiler finds include files, based on the location of the file
that contains the "#include" directive. It applies even to #include's
in the main source file.
|
| The help file for the /include qualifier for V5.5 has a detailed
description of exactly how #include files are found, and how the
/nested qualifier affects the processing. The intent is that it
should allow these questions to be answered unambiguously. To me,
(re-)reading it answered all the questions asked here. If people
who read it couldn't answer the questions, and/or have constructive
suggestions on how to simplify or further clarify the documentation,
that would be appreciated. However, changing the name of the /nested
qualifier isn't really practical.
|