core/util: indirection to CommandLine class added to make bochs compile

If CommandLine.hpp and (indirectly) optionparser.h is #included in
FailBochsInit.ah, bochs compilation fails (for, e.g., gui/x.cc, at least
on Debian 6).
This commit is contained in:
Horst Schirmeier
2013-03-14 18:13:13 +01:00
parent 06c02e2fa1
commit 422db3e21d
3 changed files with 21 additions and 2 deletions

View File

@ -4,6 +4,7 @@
#include "BochsMemory.hpp"
#include "../SALInst.hpp"
#include "../Listener.hpp"
#include "util/CommandLine.hpp"
namespace fail {
@ -173,4 +174,9 @@ ConcreteCPU& BochsController::detectCPU(BX_CPU_C* pCPU) const
return getCPU(i);
}
void BochsController::collectCommandLineArguments(int argc, char **argv) const
{
CommandLine::Inst().collect_args(bx_startup_flags.argc, bx_startup_flags.argv);
}
} // end-of-namespace: fail

View File

@ -150,6 +150,20 @@ public:
* @see The uses SimulatorController::getCPU().
*/
ConcreteCPU& detectCPU(BX_CPU_C* pCPU) const;
protected:
/**
* Hack: Indirection for commandline argument collection
*
* This prevents CommandLine.hpp (and optionparser.h) from being pulled
* inbe to every single Bochs translation unit via FailBochsInit.ah,
* leading to compilation errors in some of them.
* TODO: Move this upwards to SimulatorController?
*
* @param argc main()'s argument counter
* @param argv main()'s argument value vector
*/
void collectCommandLineArguments(int argc, char **argv) const;
};
} // end-of-namespace: fail

View File

@ -6,12 +6,11 @@
#ifdef BUILD_BOCHS
#include "../SALInst.hpp"
#include "util/CommandLine.hpp"
aspect FailBochsInit {
advice call("int bxmain()") : before ()
{
fail::CommandLine::Inst().collect_args(bx_startup_flags.argc, bx_startup_flags.argv);
fail::simulator.collectCommandLineArguments(bx_startup_flags.argc, bx_startup_flags.argv);
fail::simulator.startup();
}
};