[aspectc-user] compile error when using puma
Olaf Spinczyk
Olaf.Spinczyk at informatik.uni-erlangen.de
Mon Dec 5 12:55:28 CET 2005
Hi,
this problem is a problem of the build environment. The Puma header
files are the result of a weaving process. Depending on your TARGET
setting, i.e. debug or release mode, while compiling, the resulting
header files are different. By default, Puma is compiled with the TARGET
setting "linux-release". In the file Puma/vars.mk you can see that in
this case -DNDEBUG is used as a compiler option. I suppose that this
option is missing in your command line.
To avoid this problem you could copy and adapt the AspectC++ Makefile,
which includes vars.mk to get the right compiler settings.
- Olaf
Ralf Stephan wrote:
> Hello,
> I'm trying to use Puma for manipulating C++ source code. In the old
> documentation, there is an example program to delete a class declaration
> from a project. As Puma has evolved somewhat, this can't be compiled but
> I tried to write a new version which, hoever, can't be made to compile too.
>
> Could you please, help me? When saying g++ -c file.cc I get
>
> /usr/local/include/Puma/TraceSyntax.ah:36: error: ‘aspect’ does not name a type
>
> and when saying ag++ -c file.cc I get
>
> error: Execution failed: "ac++" --config "puma.config" -p. -c "use00.cpp" -o "use00.acc"
>
> Here is file.cc:
>
> #include "Puma/CCParser.h"
> #include "Puma/CProject.h"
> #include "Puma/ErrorStream.h"
> #include "Puma/StringSource.h"
> #include "Puma/ManipCommander.h"
> #include "Puma/MatchCollector.h"
> #include "Puma/CTranslationUnit.h"
>
> #include <stdio.h>
>
> using namespace Puma;
>
> int main (int argc, char **argv)
> {
> // two parameters
> char *filename = "desktop.h";
> char *classname = "SPDesktop";
>
> ErrorStream es;
> CProject project (es, argc, argv, "/home/ralf/tmp/inkscape-0.43/src");
> Unit *unit = project.scanFile (filename);
>
> const char* prefix = "\\do-decl-specifiers \\any-decl-specifiers ( \\exact \\do-declaration \\in-class-spec class";
> const char* postfix = "\\any-base-spec-list { \\any-member-list } ; )";
> char* matchexpr = new char[strlen (prefix) + strlen (postfix) + strlen (classname) + 1];
> sprintf (matchexpr, "%s %s %s", prefix, classname, postfix);
>
> CCParser parser;
> CTranslationUnit *tunit = parser.parse (*unit, project);
>
> MatchCollector collector (matchexpr);
> collector.collect (project, *tunit);
> CMatch *match = collector.Match(0);
> CSubMatch *submatch = match->SubMatch(unsigned(0));
> CTree *tree = submatch->Tree(0);
>
> ManipCommander commander;
> commander.kill (tree);
> if (commander.valid())
> {
> cout << "couldn't remove class decl" << endl;
> exit(1);
> }
> commander.commit();
>
> project.saveMode (CProject::RENAME_OLD, ".bak");
> project.save (unit);
>
> if (es.severity() < sev_error)
> cout << "success!" << endl;
>
> return 0;
> }
>
> ralf
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user
More information about the aspectc-user
mailing list