https://svn.lrde.epita.fr/svn/nolimips/trunk
ChangeLog | 18 ++++++++++++++++++ src/inst/data_section.hh | 9 +++++++-- src/inst/exp.hh | 2 +- src/inst/inst.hh | 2 +- src/inst/label.hh | 3 +-- src/inst/label_exp.hh | 2 ++ src/inst/nodes.gen.py | 15 ++++++++++----- src/inst/op_exp.hh | 2 ++ src/inst/program.hh | 2 +- src/inst/register.hh | 4 +--- src/inst/section.hh | 1 + src/parse/asm-parse.yy.gen.py | 3 --- src/parse/asm-scan.ll.gen.py | 2 ++ src/vm/cpu.cc | 2 -- src/vm/cpu.hh | 6 ++++-- src/vm/virtual_machine.cc | 1 + src/vm/virtual_machine.hh | 6 +++--- 17 files changed, 55 insertions(+), 25 deletions(-)
Index: ChangeLog from Benoît Perrot benoit@lrde.epita.fr
Reduce includes' dependencies. * src/vm/cpu.hh, src/vm/cpu.cc * src/vm/virtual_machine.hh, src/vm/virtual_machine.cc * src/parse/asm-parse.yy.gen.py, src/parse/asm-scan.ll.gen.py, * src/inst/register.hh, * src/inst/op_exp.hh, * src/inst/label_exp.hh, * src/inst/exp.hh, * src/inst/section.hh, src/inst/data_section.hh, * src/inst/program.hh * src/inst/nodes.gen.py * src/inst/inst.hh * src/inst/label.hh: Remove unused includes, forward-declare classes.
Index: src/vm/cpu.hh --- src/vm/cpu.hh (revision 194) +++ src/vm/cpu.hh (revision 195) @@ -25,13 +25,15 @@
# include <stdint.h>
-# include <stack> +# include <vector> + +# include "common.hh"
# include "misc/table.hh"
+# include "inst/inst.hh" # include "inst/visitor.hh" # include "inst/register.hh" -# include "inst/program.hh"
# include "vm/mmu.hh"
Index: src/vm/virtual_machine.hh --- src/vm/virtual_machine.hh (revision 194) +++ src/vm/virtual_machine.hh (revision 195) @@ -21,19 +21,19 @@ #ifndef VM_VIRTUAL_MACHINE_HH # define VM_VIRTUAL_MACHINE_HH
-# include <iostream> +# include <ostream>
# include "misc/contract.hh" # include "misc/has.hh" # include "common.hh"
-# include "inst/program.hh" - # include "vm/memory.hh" # include "vm/mmu.hh" # include "vm/cp0.hh" # include "vm/cpu.hh"
+namespace inst { class Program; } + namespace vm { class SystemLibrary; Index: src/vm/cpu.cc --- src/vm/cpu.cc (revision 194) +++ src/vm/cpu.cc (revision 195) @@ -18,8 +18,6 @@ // #include <iomanip>
-#include "common.hh" - #include "vm/cpu.hh" #include "vm/system_library.hh"
Index: src/vm/virtual_machine.cc --- src/vm/virtual_machine.cc (revision 194) +++ src/vm/virtual_machine.cc (revision 195) @@ -17,6 +17,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #include "vm/virtual_machine.hh" +#include "inst/program.hh"
namespace vm { Index: src/parse/asm-scan.ll.gen.py --- src/parse/asm-scan.ll.gen.py (revision 194) +++ src/parse/asm-scan.ll.gen.py (revision 195) @@ -284,6 +284,8 @@ } #endif
+#include <stack> + namespace parse {
Index: src/parse/asm-parse.yy.gen.py --- src/parse/asm-parse.yy.gen.py (revision 194) +++ src/parse/asm-parse.yy.gen.py (revision 195) @@ -50,12 +50,9 @@ #include "inst/register.hh" #include "inst/all.hh"
-#include "vm/cpu.hh" - #include "parse/libparse.hh"
using namespace inst; -using vm::Cpu; %}
%error-verbose Index: src/inst/register.hh --- src/inst/register.hh (revision 194) +++ src/inst/register.hh (revision 195) @@ -19,9 +19,7 @@ #ifndef INST_REGISTER_HH # define INST_REGISTER_HH
-# include <iostream> - -# include "misc/contract.hh" +# include <ostream>
namespace inst { Index: src/inst/op_exp.hh --- src/inst/op_exp.hh (revision 194) +++ src/inst/op_exp.hh (revision 195) @@ -19,6 +19,8 @@ #ifndef INST_OP_EXP_HH # define INST_OP_EXP_HH
+# include <ostream> + # include "inst/exp.hh"
namespace inst Index: src/inst/label_exp.hh --- src/inst/label_exp.hh (revision 194) +++ src/inst/label_exp.hh (revision 195) @@ -19,6 +19,8 @@ #ifndef INST_LABEL_EXP_HH # define INST_LABEL_EXP_HH
+# include <ostream> + # include "misc/unique_string.hh"
# include "inst/exp.hh" Index: src/inst/exp.hh --- src/inst/exp.hh (revision 194) +++ src/inst/exp.hh (revision 195) @@ -19,7 +19,7 @@ #ifndef INST_EXP_HH # define INST_EXP_HH
-# include <iostream> +# include <ostream>
# include "misc/contract.hh" # include "misc/lockable.hh" Index: src/inst/data_section.hh --- src/inst/data_section.hh (revision 194) +++ src/inst/data_section.hh (revision 195) @@ -23,15 +23,20 @@
# include <stdint.h>
-# include <iostream> +# include <ostream> # include <vector> +# include <string> + +# include "misc/contract.hh" +# include "misc/unique_string.hh"
# include "inst/section.hh" -# include "inst/inst.hh"
namespace inst {
+ class Label; + /// Abstract an assembly data section class DataSection: public Section Index: src/inst/section.hh --- src/inst/section.hh (revision 194) +++ src/inst/section.hh (revision 195) @@ -19,6 +19,7 @@ #ifndef INST_SECTION_HH # define INST_SECTION_HH
+# include <ostream> # include <set>
# include "misc/contract.hh" Index: src/inst/program.hh --- src/inst/program.hh (revision 194) +++ src/inst/program.hh (revision 195) @@ -19,7 +19,7 @@ #ifndef INST_PROGRAM_HH # define INST_PROGRAM_HH
-# include <iostream> +# include <ostream>
# include "inst/text_section.hh" # include "inst/data_section.hh" Index: src/inst/nodes.gen.py --- src/inst/nodes.gen.py (revision 194) +++ src/inst/nodes.gen.py (revision 195) @@ -68,17 +68,22 @@ print """ # include "inst/register.hh" # include "inst/exp.hh" -# include "inst/inst.hh" -# include "inst/visitor.hh" -""" +# include "inst/inst.hh"""" + + sys.stdout = impl + print "#include "inst/visitor.hh"" + for f in [inline, impl]: sys.stdout = f print "#include "inst/" + file_id + ".hh"" + # Open namespace for f in [header, inline, impl]: sys.stdout = f - print "\nnamespace inst\n{\n" - + print """ +namespace inst +{ +"""
## Declare class sys.stdout = header Index: src/inst/inst.hh --- src/inst/inst.hh (revision 194) +++ src/inst/inst.hh (revision 195) @@ -19,7 +19,7 @@ #ifndef INST_INST_HH # define INST_INST_HH
-# include <iostream> +# include <ostream>
# include "inst/visitor.hh"
Index: src/inst/label.hh --- src/inst/label.hh (revision 194) +++ src/inst/label.hh (revision 195) @@ -19,9 +19,8 @@ #ifndef INST_LABEL_HH # define INST_LABEL_HH
-# include <set> # include <string> -# include <iostream> +# include <ostream>
# include "misc/contract.hh" # include "misc/lockable.hh"
"Benoît" == Benoît Perrot benoit@lrde.epita.fr writes:
Index: ChangeLog from Benoît Perrot benoit@lrde.epita.fr
Reduce includes' dependencies.
- src/vm/cpu.hh, src/vm/cpu.cc
- src/vm/virtual_machine.hh, src/vm/virtual_machine.cc
- src/parse/asm-parse.yy.gen.py, src/parse/asm-scan.ll.gen.py,
- src/inst/register.hh,
- src/inst/op_exp.hh,
- src/inst/label_exp.hh,
- src/inst/exp.hh,
- src/inst/section.hh, src/inst/data_section.hh,
- src/inst/program.hh
- src/inst/nodes.gen.py
- src/inst/inst.hh
- src/inst/label.hh:
Remove unused includes, forward-declare classes.
What was your strategy to find out what could be done?
Remove unused includes, forward-declare classes.
What was your strategy to find out what could be done?
Helas! ... An incremental one :P Try / Compile / Revert ... beaurk.
I just wanted to localy simplify the dependencies, so that I could modify one file without having to rebuild the world :/
What was your strategy to find out what could be done?
Doxygen can generate an XML output. One could imagine a not-so-smart python script that would analyze includes' dependencies and relevancies, given the attributes and base of a considered class. ... SMOP. Heum.