#pragma preprocessor directives.
CScout uses the following pragmas:
#pragma echo "STRING"Example:
#pragma echo "Processing workspace date\n"
#pragma ro_prefix "STRING"Example:
#pragma ro_prefix "C:\gcc"
#pragma define_immutable macro definition#define command, but
mark the definition as one that cannot be later be undefined or redefined.
This is useful for defining macros that handle compiler extensions
so that code cannot change them.
#pragma project "STRING"Example:
#pragma project "date"
#pragma block_enterblock_enter will enter the project scope
(linkage unit); the second encountered nested
block_enter will enter the file scope
(compilation unit).
#pragma block_exitblock_enter pragmas should match the number of
block_exit pragmas and there should never be more
than two block_enter pragmas in effect.
#pragma process "STRING"Example:
#pragma process "date.d"
#pragma pushd "STRING"Example:
#pragma pushd "cp"
#pragma popd pushd pragmas should match the number of
popd pragmas.
#pragma set_dp "STRING INTEGERdbpoints file, it is enabled at a particular
code instance using the #pragma set_dp.
Example:
#pragma set_dp "macro.cpp" 486
#pragma includepath "STRING"Example:
#pragma includepath "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include"
#pragma clear_include
#pragma clear_defines #define C preprocessor directive.
// workspace bin
#pragma echo "Processing workspace bin\n"
#pragma ro_prefix "/usr/include"
#pragma echo "Entering directory /usr/src/bin"
#pragma pushd "/usr/src/bin"
// project date
#pragma echo "Processing project date\n"
#pragma project "date"
#pragma block_enter
#pragma echo "Entering directory date"
#pragma pushd "date"
// file date.c
#pragma echo "Processing file date.c\n"
#pragma block_enter
#pragma clear_defines
#pragma clear_include
#include "/home/dds/src/cscout/cscout_defs.h"
#include "/home/dds/src/cscout/cscout_incs.h"
#pragma process "date.c"
#pragma block_exit
#pragma echo "Done processing file date.c\n"
#pragma echo "Exiting directory date\n"
#pragma popd
#pragma block_exit
#pragma echo "Done processing project date\n"
#pragma echo "Exiting directory /usr/src/bin\n"
#pragma popd
#pragma echo "Done processing workspace bin\n"
config LINT
make depend)
and compile
(make).
This step is used to create all automatically generated C and header files.
Also during this step note the include path used, in order to provide
CScout with the same specification.
rm *.o).
.include "$S/conf/kern.pre.mk"
The code below was added after the line above
NORMAL_C= echo '\#pragma echo "Processing file ${.IMPSRC}\n"' >>kernel.cs ;\
echo '\#pragma block_enter' >>kernel.cs ;\
echo '\#pragma clear_defines' >>kernel.cs ;\
echo '\#pragma clear_include' >>kernel.cs ;\
echo '\#include "cscout_defs.h"' >>kernel.cs ;\
for i in $(INCLUDES) ; \
do \
case $$i in \
-nostdinc) continue ;; \
-I-) continue ;; \
esac ; \
i=`echo $$i | sed 's/-I//'` ; \
echo '\#pragma includepath "'$$i'"' >>kernel.cs ; \
done ; \
echo '\#define _KERNEL 1' >>kernel.cs ;\
echo '\#pragma process "opt_global.h"' >>kernel.cs ;\
echo '\#pragma process "${.IMPSRC}"' >>kernel.cs ;\
echo '\#pragma block_exit' >>kernel.cs ;\
echo '\#pragma echo "Done processing file ${.IMPSRC}\n"' >>kernel.cs
cscout_incs.h file for each different architecture.
#pragma echo "Processing workspace FreeBSD kernel\n"
#pragma echo "Entering directory sys/i386/compile/LINT\n"
#pragma pushd "sys/i386/compile/LINT"
#pragma echo "Processing project i386\n"
#pragma project "i386"
#pragma block_enter
#include "kernel.cs"
#pragma echo "Exiting directory sys/i386/compile/LINT\n"
#pragma popd
#pragma echo "Done processing project i386\n"
#pragma block_exit
#pragma echo "Entering directory sys/amd64/compile/GENERIC\n"
// [...]
// and so on for all architectures
// [...]
#pragma echo "Exiting directory sys/sparc64/compile/LINT\n"
#pragma popd
#pragma echo "Done processing project sparc64\n"
#pragma block_exit
Note that the
block_enter and
block_exit pragmas
are furnished by this top-level file.
CScout HomeFile MetricsWritable FilesNumber of files: 4310
|