View Issue Details

IDProjectCategoryView StatusLast Update
0038304FPCCompilerpublic2021-01-23 14:24
ReporterPaul Robinson <> Assigned ToSven Barth  
Status resolvedResolutionwon't fix 
Summary0038304: Feature request to ignore compiler directove "$CREF "
DescriptionI am writing a cross-reference program that handles expanded Pascal (where UNITs are available) among other features of Object Pascal. Now, there have been cross reference programs for Pascal since the 1980s; even Nicklaus Wirth wrote one. But, they were all written for "monolithic" programs where one file was used or perhaps some include file, but the concept of the UNIT had not been thought of at the time. With programmers doing ever larger progams I think a cross-reference tool is something most programmers don't even know they need.

Remebering where variables. procedures and functions aredeclared, defined or used would be important. But more than that, one thing a cross-refernce tool can do is procedure (and unit) tracing, suh as

  Procedure DF4
    is defined on line 103
    it is called by
        procedurr ZagAT on line 201
        function next on lines 714, 720
   it calls
        procedure Bee on line 116
        function trill on lines 125, 128, 129

The same thing can be done for UNITs, listing a dependency tree; units it uses, units it is used by, etc. (At this point we cue in Annie Lennox "Sweet Dreams (Are Made Of This)": "Some of them want to use you, some of them want to get used by you.")

So to allow this to work seamlessly, I'd like someone submitting the source of their program to the cross-reference tool to be able to embed instruction to the cross-reference tool in the same manner as compiler directives/ Using a directive like {$CREF arguments} or (*$cref Argumnts*) they can pass parameters to the cross-reference tool. Now, I could use a separate configuration file except for simple uses one shouldn't have to write a separate file, since the cross-reference tool reads their program anyway, they should be able to just pass instructions in the source code. The only problem is Free Pascal throws a warning if it sees a compiler directive it doesn't recognize.

Therefore, I wold like to request that Free Pascal's compiler directives scanner be programmed to ignore a comment directive beginning with $cref (regardless of case, of course).

Thank you for your attention
Paul Robinson

TagsNo tags attached.
Fixed in Revision
Attached Files


Tomas Hajny

2021-01-04 10:27

manager   ~0128065

Note that there are already other documentation tools using inline information while not requiring special compiler support - see e.g. .


2021-01-04 13:39

administrator   ~0128069

Why not using another kind of directive marker? E.g. the FPC regression tests use { %... }
Two things:
1. I hadn't thought of using other markers such as % as regression tests or < as Pasdsoc. I'll keep that in miod.
2. I was not aware of PasDoc; I will examine it in greater detail (I've already downloaded it from GitHub) and it looks like it may do a lot of the "heavy lifting," for me, i.e. it includes processing code I won't have to write. and as it is already generating HTMl, that's one less thing I have to implement.

Thank you. As a result of this, ['m going to make a suggestion on how to fix something mentioned in the documentation is a problem: crock recursion in $DEFINE and macro substitution.

Sven Barth

2021-01-23 11:54

manager   ~0128512

But whatever problem that is, that isn't part of this bug report. So I'm resolving this. ;)
Pasdoc is restricted to documenting UNIT files only, and is not intended to handle MAIN programs. This makes it useless for documenting something like the Stanford Pascal Compiler, a 24,600+ line, 1.1 MB program consisting of one file and does not use any Unit (which in that compiler, in keeping with Standard Pascal, are called Module).

Issue History

Date Modified Username Field Change
2021-01-04 01:50 Paul Robinson <> New Issue
2021-01-04 10:27 Tomas Hajny Note Added: 0128065
2021-01-04 13:39 Florian Note Added: 0128069
2021-01-23 09:19 Paul Robinson <> Note Added: 0128498
2021-01-23 11:54 Sven Barth Assigned To => Sven Barth
2021-01-23 11:54 Sven Barth Status new => resolved
2021-01-23 11:54 Sven Barth Resolution open => won't fix
2021-01-23 11:54 Sven Barth FPCTarget => -
2021-01-23 11:54 Sven Barth Note Added: 0128512
2021-01-23 14:24 Paul Robinson <> Note Added: 0128514