🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++.moderated
Article #16

Tool for removing surplus #includes

#16
From: Tony Houghton
Date: Fri, 23 Feb 1996 00:12
44 lines
1725 bytes
Does anyone know of a PD tool available with portable(ish) source for
removing surplus #include directives? For example:

/* "file2.h" */
#include "file1.h"

-------------------

/* "file3.h" */
#include "file1.h"
#include "file2.h"

-------------------

#include "file1.h" could be removed from "file3.h". This sort of thing
saves a lot of compiler time without having the chore of typing:

#ifndef __file1_h
#include "file1.h"
#endif

Ideally the tool should be able to remove the #ifndef structure as well.

I know I will still need to do:

/* "file1.h" */
#ifndef __file1_h
#define __file1_h
/* Body of file */
#endif

but having an additional check around any #include directives or not
doing the include at all saves the compiler lots of time having to load
a file it's already included.

My C compiler does have an include_only_once pragma, but it doesn't seem
to work in CFront.

-- 
Tony Houghton                     tonyh@tcp.co.uk
Using an Acorn RiscPC 700         http://www.tcp.co.uk/~tonyh/
No Intel inside, no Microsoftware, no hassles
----------------------------------------------------------------
The Internet is a most invaluable resource for Internet software
Technical Details
Message-ID: <4gj0p3$lp0@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: Tony Houghton <tonyh@tcp.co.uk>
Newsgroups: comp.lang.c++.moderated,comp.lang.c.moderated,comp.lang.c++,comp.lang.c
Subject: Tool for removing surplus #includes
Date: 22 Feb 1996 18:12:18 -0600
Organization: UWL
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4gj0p3$lp0@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com
X-Newsreader: Messenger v0.17 for RISC OS
X-Posting-Agent: RISC OS Newsbase 0.55-pre-12a