View | Details | Raw Unified | Return to bug 18462 | Differences between
and this patch

Collapse All | Expand All

(-)a/NEWS (+5 lines)
Lines 1-5 Link Here
1
* What's new in version 2.9
1
* What's new in version 2.9
2
2
3
- The following tapset variables and functions are deprecated in
4
  version 2.9:
5
  - The '__int32_compat' library macro got deprecated in favor of
6
    new '__compat_long' library macro.
7
3
* What's new in version 2.8, 2015-06-17
8
* What's new in version 2.8, 2015-06-17
4
9
5
- SystemTap has improved support for probing golang programs. Work has been
10
- SystemTap has improved support for probing golang programs. Work has been
(-)a/parse.cxx (-6 / +7 lines)
Lines 120-126 private: Link Here
120
  map<string, macrodecl*> pp1_namespace;
120
  map<string, macrodecl*> pp1_namespace;
121
  vector<pp1_activation*> pp1_state;
121
  vector<pp1_activation*> pp1_state;
122
  const token* next_pp1 ();
122
  const token* next_pp1 ();
123
  const token* scan_pp1 ();
123
  const token* scan_pp1 (int skip);
124
  const token* slurp_pp1_param (vector<const token*>& param);
124
  const token* slurp_pp1_param (vector<const token*>& param);
125
  const token* slurp_pp1_body (vector<const token*>& body);
125
  const token* slurp_pp1_body (vector<const token*>& body);
126
126
Lines 425-431 parser::next_pp1 () Link Here
425
}
425
}
426
426
427
const token*
427
const token*
428
parser::scan_pp1 ()
428
parser::scan_pp1 (int skip = 0)
429
{
429
{
430
  while (true)
430
  while (true)
431
    {
431
    {
Lines 442-448 parser::scan_pp1 () Link Here
442
        }
442
        }
443
443
444
      // macro definition
444
      // macro definition
445
      if (t->type == tok_operator && t->content == "@define")
445
      // refer to PR18462#c5 re. the 'skip' parameter
446
      if (t->type == tok_operator && t->content == "@define" && skip == 0)
446
        {
447
        {
447
          if (!pp1_state.empty())
448
          if (!pp1_state.empty())
448
            throw PARSE_ERROR (_("'@define' forbidden inside macro body"), t);
449
            throw PARSE_ERROR (_("'@define' forbidden inside macro body"), t);
Lines 718-724 parser::parse_library_macros () Link Here
718
719
719
  try
720
  try
720
    {
721
    {
721
      const token* t = scan_pp1 ();
722
      const token* t = scan_pp ();
722
723
723
      // Currently we only take objection to macro invocations if they
724
      // Currently we only take objection to macro invocations if they
724
      // produce a non-whitespace token after being expanded.
725
      // produce a non-whitespace token after being expanded.
Lines 726-732 parser::parse_library_macros () Link Here
726
      // XXX should we prevent macro invocations even if they expand to empty??
727
      // XXX should we prevent macro invocations even if they expand to empty??
727
728
728
      if (t != 0)
729
      if (t != 0)
729
        throw PARSE_ERROR (_F("library macro file '%s' contains non-@define construct", input_name.c_str()), t);
730
        throw PARSE_ERROR (_F("unexpected end of library macro file '%s'", input_name.c_str()), t);
730
731
731
      // We need to first check whether *any* of the macros are duplicates,
732
      // We need to first check whether *any* of the macros are duplicates,
732
      // then commit to including the entire file in the global namespace
733
      // then commit to including the entire file in the global namespace
Lines 1149-1155 parser::skip_pp () Link Here
1149
    {
1150
    {
1150
      try
1151
      try
1151
        {
1152
        {
1152
          t = scan_pp1 ();
1153
          t = scan_pp1 (1);
1153
        }
1154
        }
1154
      catch (const parse_error &e)
1155
      catch (const parse_error &e)
1155
        {
1156
        {
(-)a/tapset/linux/syscalls.stpm (+2 lines)
Lines 157-162 Link Here
157
	}
157
	}
158
%)
158
%)
159
159
160
%( systemtap_v <= "2.9" %?
160
@define __int32_compat(arg)
161
@define __int32_compat(arg)
161
%(
162
%(
162
    %( CONFIG_64BIT == "y" %?
163
    %( CONFIG_64BIT == "y" %?
Lines 165-170 Link Here
165
        (__int32(@arg))
166
        (__int32(@arg))
166
    %)
167
    %)
167
%)
168
%)
169
%)
168
170
169
@define __keyctl_argstr(option, arg2, arg3, arg4, arg5)
171
@define __keyctl_argstr(option, arg2, arg3, arg4, arg5)
170
%(
172
%(
(-)a/testsuite/parseok/macros09.stp (+126 lines)
Line 0 Link Here
1
#! /bin/sh
2
3
# Test macro deprecation PR18462.
4
5
# Testcase wrapper (parseok.exp) checks for exitcode, so we need to terminate right after an error occurs.
6
set -e
7
8
# let's play in cwd, since that should be writable by any user potentially involved
9
export SYSTEMTAP_TAPSET=.
10
11
MYSTPM=$SYSTEMTAP_TAPSET/PR18462.stpm
12
13
# basic tests
14
# ______________________________________________________________________________
15
16
cat > $MYSTPM <<EOF01
17
@define __testmacro %( 7 %)
18
EOF01
19
20
stap -p1 - <<EOF02
21
probe begin { println(@__testmacro) }
22
EOF02
23
24
cat > $MYSTPM <<EOF03
25
%( 1 == 1 %?
26
@define __testmacroA %( 7 %)
27
%:
28
@define __testmacroB %( 7 %)
29
%)
30
EOF03
31
32
stap -p1 - <<EOF04
33
probe begin { println(@__testmacroA) }
34
EOF04
35
36
! stap -p1 - <<EOF05
37
probe begin { println(@__testmacroB) }
38
EOF05
39
40
cat > $MYSTPM <<EOF06
41
%( "a" == "b" %?
42
@define __testmacroC %( 7 %)
43
%:
44
@define __testmacroD %( 7 %)
45
%)
46
EOF06
47
48
! stap -p1 - <<EOF07
49
probe begin { println(@__testmacroC) }
50
EOF07
51
52
stap -p1 - <<EOF08
53
probe begin { println(@__testmacroD) }
54
EOF08
55
56
# both the true and false side of a conditional are defining the same macro name
57
# ______________________________________________________________________________
58
59
cat > $MYSTPM <<EOF09
60
%( 1 == 1 %?
61
@define __testmacroE %( 7 %)
62
%:
63
@define __testmacroE %( 9 %)
64
%)
65
EOF09
66
67
stap -p1 - <<EOF10
68
probe begin { println(@__testmacroE) }
69
EOF10
70
71
cat > $MYSTPM <<EOF11
72
%( 1 != 1 %?
73
@define __testmacroF %( 7 %)
74
%:
75
@define __testmacroF %( 9 %)
76
%)
77
EOF11
78
79
stap -p1 - <<EOF12
80
probe begin { println(@__testmacroF) }
81
EOF12
82
83
# test nested conditionals
84
# ______________________________________________________________________________
85
86
cat > $MYSTPM <<EOF13
87
%( 1 == 1 %?
88
  %( 1 == 1 %?
89
    @define __testmacroG %( 7 %)
90
  %:
91
    @define __testmacroH %( 7 %)
92
  %)
93
%:
94
@define __testmacroI %( 7 %)
95
%)
96
EOF13
97
98
stap -p1 - <<EOF14
99
probe begin { println(@__testmacroG) }
100
EOF14
101
102
! stap -p1 - <<EOF15
103
probe begin { println(@__testmacroH) }
104
EOF15
105
106
! stap -p1 - <<EOF16
107
probe begin { println(@__testmacroI) }
108
EOF16
109
110
# test some expected errors
111
# ______________________________________________________________________________
112
113
# incomplete conditional at end of file
114
cat > $MYSTPM <<EOF17
115
%( 1 == 1 %?
116
@define __testmacroJ %( 7 %)
117
EOF17
118
119
! stap -p1 - <<EOF18
120
probe begin { println(@__testmacroJ) }
121
EOF18
122
123
rm -f $MYSTPM
124
125
set +e
126

Return to bug 18462