main.o: inputtype.h
main.o: level.h
main.o: lint.h
+main.o: macro.h
main.o: nobitfield.h
main.o: nocross.h
main.o: nopp.h
ch3bin.o: label.h
ch3bin.o: lint.h
ch3bin.o: nobitfield.h
+ch3bin.o: nocross.h
ch3bin.o: nopp.h
+ch3bin.o: sizes.h
ch3bin.o: spec_arith.h
ch3bin.o: struct.h
+ch3bin.o: trgt_sizes.h
ch3bin.o: type.h
cstoper.o: Lpars.h
cstoper.o: arith.h
.BE procexit .
These routines are supplied with one parameter, a pointer to a
string containing the name of the procedure.
+.IP \fB\-A\fR[\fIfile\fR]
+.br
+if \fIfile\fR is not given, generate a list
+of makefile dependencies and write them to the standard output.
+If \fIfile\fP is given,
+generate the list of makefile dependencies on file \fIfile\fP.
+.IP \fB-i\fR
+when generating makefile dependencies, do not include files from
+/usr/include.
+.IP \fB-m\fR
+when generating makefile dependencies, generate them in the following format:
+.RS
+.IP "file.o: file1.h"
+.RE
+.IP ""
+where "file.o" is derived from the source file name. Normally, only a list
+of files included is generated.
.IP \fB\-R\fR
interpret the input as restricted C (according to the language as
described in \fIThe C programming language\fR by Kernighan and Ritchie.)
To specify that the bitfields should be right adjusted instead of the
default left adjustment, specify \fBr\fR as \fIc\fR parameter.
.IP \fB\-w\fR
-suppress warning messages
+suppress warning messages.
+.IP \fB\-s\fR
+suppress stricts.
+.IP \fB\-a\fR
+suppress warnings and stricts.
.IP \fB\-\-\fItext\fR
.br
where \fItext\fR can be either of the above or
dtp->tp_size = tp->tp_size;
dtp->tp_pointer = tp->tp_pointer;
dtp->tp_array = tp->tp_array;
+#if 0
+/* The tp_function field does not exist now. See the comment in the
+ function_of() routine.
+*/
dtp->tp_function = tp->tp_function;
+#endif
switch (fund) {
case ARRAY:
if (typequal) {
if (filenm) {
if (!InsertFile(filenm, &inctable[tok==FILESPECIFIER],&result)){
error("cannot open include file \"%s\"", filenm);
+ add_dependency(filenm);
}
else {
+ add_dependency(result);
WorkingDir = getwdir(result);
File_Inserted = 1;
FileName = result;
#define K_LINE 10
#define K_PRAGMA 11
#define K_UNDEF 12
+#define K_FILE 100 /* for dependency generator */
#endif NOPP
#include "nocross.h"
#include "sizes.h"
#include "align.h"
+#include "macro.h"
+#include "assert.h"
extern struct tokenname tkidf[];
extern char *symbol2str();
int inc_max;
char **inctable;
+extern int do_dependencies;
+extern char *dep_file;
+static File *dep_fd = STDOUT;
+
extern char *getwdir();
#endif NOPP
if (options['m']) Info();
#endif DEBUG
+#ifndef NOPP
+ if (do_dependencies) {
+ extern char *source;
+
+ list_dependencies(source);
+ }
+#endif
sys_stop(err_occurred ? S_EXIT : S_END);
/*NOTREACHED*/
}
+#ifndef NOPP
+
+struct idf *file_head;
+extern char *strrindex();
+
+list_dependencies(source)
+char *source;
+{
+ register struct idf *p = file_head;
+
+ if (source) {
+ register char *s = strrindex(source, '.');
+
+ if (s && *(s+1)) {
+ s++;
+ *s++ = 'o';
+ *s = '\0';
+ /* the source may be in another directory than the
+ * object generated, so don't include the pathname
+ * leading to it.
+ */
+ if (s = strrindex(source, '/')) {
+ source = s + 1;
+ }
+ }
+ else source = 0;
+ }
+ if (dep_file && !sys_open(dep_file, OP_WRITE, &dep_fd)) {
+ fatal("could not open %s", dep_file);
+ }
+ while (p) {
+ ASSERT(p->id_resmac == K_FILE);
+ dependency(p->id_text, source);
+ p = (struct idf *) (p->id_file);
+ }
+}
+
+add_dependency(s)
+char *s;
+{
+ register struct idf *p = str2idf(s, 0);
+
+ if (! p->id_resmac) {
+ p->id_resmac = K_FILE;
+ p->id_file = (char *) file_head;
+ file_head = p;
+ }
+}
+
+dependency(s, source)
+char *s, *source;
+{
+ if (options['i'] && !strncmp(s, "/usr/include/", 13)) {
+ return;
+ }
+ if (options['m'] && source) {
+ fprint(dep_fd, "%s: %s\n", source, s);
+ }
+ else fprint(dep_fd, "%s\n", s);
+}
+
+#endif NOPP
+
char *source = 0;
#ifdef GEN_NM_LIST
User options:
+a no warnings or stricts
+A while running preprocessor, generate makefile dependencies
C while running preprocessor, copy comment
+d perform a small dataflow analysis
D see identifier following as a macro
E run preprocessor only
+i suppress /usr/include include files in dependency list
I expand include table with directory name following
+m generate file.o: file1.h format dependency lines
M set identifier length
n don't generate register messages
-p generate linenumbers and filename indications
- while generating EM code
+L don't generate linenumbers and filename indications
+p trace
P in running the preprocessor do not output '# line' lines
R restricted C
+s no stricts
T take path following as directory for storing temporary file(s)
U undefine predefined name
V set objectsize and alignment requirements
Debug options:
-d perform a small dataflow analysis
f dump whole identifier table, including macros and reserved words
h supply hash table statistics
i print name of include files
-m supply memory allocation statistics
r right-adjust bitfield
t dump table of identifiers
u unstack L_UNIVERSAL
extern int inc_pos;
extern int inc_max;
extern int inc_total;
+int do_dependencies = 0;
+char *dep_file = 0;
+
#endif NOPP
char options[128]; /* one for every char */
options[*text++] = 1; /* flags, debug options etc. */
goto next_option;
+#ifndef LINT
+#ifndef NOPP
+ case 'A' : /* Amake dependency generation */
+ do_dependencies = 1;
+ if (*text) {
+ dep_file = text;
+ }
+ break;
+ case 'i':
+ case 'm':
+ options[opt] = 1;
+ break;
+#endif NOPP
+#endif LINT
+
#ifndef LINT
#ifdef DATAFLOW
case 'd':
struct proto *pl;
int qual;
{
+#if 0
+/* See comment below */
register struct type *dtp = tp->tp_function;
+#else
+ register struct type *dtp;
+#endif
/* look for a type with the right qualifier */
#if 0
because updating the type works inside the data-structures for that type
thus, a new type is created for very function. This may change in the
future, when declarations with empty parameter lists become obsolete.
+ When it does, change type.str, decspecs.c, and this routine. Search for
+ the function_of pattern to find the places.
*/
while (dtp && (dtp->tp_typequal != qual || dtp->tp_proto != pl))
dtp = dtp->next;
dtp->tp_align = pointer_align;
dtp->tp_typequal = qual;
dtp->tp_proto = pl;
+#if 0
+/* See comment above */
dtp->next = tp->tp_function;
tp->tp_function = dtp;
+#endif
}
return dtp;
}
struct type {
struct type *next; /* used for ARRAY and for qualifiers */
short tp_fund; /* fundamental type */
- short tp_unsigned;
+ char tp_unsigned;
+ char tp_typequal; /* type qualifier */
int tp_align;
- int tp_typequal; /* type qualifier */
arith tp_size; /* -1 if declared but not defined */
struct type *tp_pointer; /* to POINTER */
struct type *tp_array; /* to ARRAY */
+#if 0
+/* This field is not needed now; see comment in function_of() routine. */
struct type *tp_function; /* to FUNCTION */
+#endif
union {
struct {
struct idf *tp__idf; /* name of STRUCT, UNION or ENUM */