~ubuntu-branches/ubuntu/quantal/aspectc++/quantal

« back to all changes in this revision

Viewing changes to AspectC++/tests/GlobalIds/a.ah

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __a_ah__
 
2
#define __a_ah__
 
3
 
 
4
#include <stdio.h>
 
5
 
 
6
struct GlobalMsg {
 
7
    bool instantiate;
 
8
    GlobalMsg (int id) { 
 
9
        static int last_id = -1;
 
10
        if (last_id == -1) {
 
11
            printf ("GlobalIds: checks whether a JPID is globally unique\n");
 
12
            printf ("===================================================\n");
 
13
            printf ("IDs are fine if no other message follows.\n", id);
 
14
        }
 
15
        else if (last_id != id)
 
16
            printf ("IDs of two translation units differ!\n", id);
 
17
        last_id = id;
 
18
    }
 
19
};
 
20
 
 
21
template <int ID> struct Tester {
 
22
    static GlobalMsg msg;
 
23
};
 
24
 
 
25
template <int ID> GlobalMsg Tester<ID>::msg (ID);
 
26
 
 
27
aspect IdChecker {
 
28
    advice execution ("void f()") : after () {
 
29
        Tester<JoinPoint::JPID>::msg.instantiate = true;
 
30
    }
 
31
};
 
32
 
 
33
#endif //  __a_ah__