/*
-** LCLint - annotation-assisted static program checker
-** Copyright (C) 1994-2000 University of Virginia,
+** Splint - annotation-assisted static program checker
+** Copyright (C) 1994-2001 University of Virginia,
** Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
**
** For information on lclint: lclint-request@cs.virginia.edu
** To report a bug: lclint-bug@cs.virginia.edu
-** For more information: http://lclint.cs.virginia.edu
+** For more information: http://www.splint.org
*/
/*
** cppmain.c
# include "lclintMacros.nf"
# include "llbasic.h"
-# include "cpp.h"
# include "cpplib.h"
# include "cpphash.h"
# include "cpperror.h"
llexit (LLFAILURE);
}
- ofile = fopen (cstring_toCharsSafe (outfile), "w");
+ ofile = fileTable_openFile (context_fileTable (), outfile, "w");
if (ofile == NULL)
{
}
cppReader_finish (&g_cppState);
- check (fclose (ofile) == 0);
+ check (fileTable_closeFile (context_fileTable (), ofile));
- /* Resotre the original definition table. */
+ /* Restore the original definition table. */
if (!context_getFlag (FLG_SINGLEINCLUDE))
{
return 0;
}
-void cppAddIncludeDir (cstring dir)
+void cppAddIncludeDir (cstring dir)
{
- /* -I option (Add directory to include path) */
- struct file_name_list *dirtmp = (struct file_name_list *) dmalloc (sizeof (*dirtmp));
+ /* evans 2001-08-26
+ ** Add the -I- code. This code provided by Robin Watts <Robin.Watts@wss.co.uk>
+ */
- DPRINTF (("Add include: %s", dir));
-
- dirtmp->next = 0; /* New one goes on the end */
- dirtmp->control_macro = 0;
- dirtmp->c_system_include_path = FALSE;
-
- /* This copy is necessary...but shouldn't be? */
- /*@-onlytrans@*/
- dirtmp->fname = cstring_copy (dir);
- /*@=onlytrans@*/
-
- dirtmp->got_name_map = FALSE;
- cppReader_addIncludeChain (&g_cppState, dirtmp);
+ if (cstring_equalLit (dir, "-I-"))
+ {
+ struct cppOptions *opts = CPPOPTIONS (&g_cppState);
+ opts->ignore_srcdir = TRUE;
+ }
+ else
+ {
+ /* -I option (Add directory to include path) */
+ struct file_name_list *dirtmp = (struct file_name_list *) dmalloc (sizeof (*dirtmp));
+
+ DPRINTF (("Add include: %s", dir));
+
+ dirtmp->next = 0; /* New one goes on the end */
+ dirtmp->control_macro = 0;
+ dirtmp->c_system_include_path = FALSE;
+
+ /* This copy is necessary...but shouldn't be? */
+ /*@-onlytrans@*/
+ dirtmp->fname = cstring_copy (dir);
+ /*@=onlytrans@*/
+
+ dirtmp->got_name_map = FALSE;
+ cppReader_addIncludeChain (&g_cppState, dirtmp);
+ }
}
void cppDoDefine (cstring str)
void cppDoUndefine (cstring str)
{
int sym_length;
- HASHNODE *hp;
+ hashNode hp;
char *buf = cstring_toCharsSafe (str);
sym_length = cppReader_checkMacroName (&g_cppState, buf,