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 (bool 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 (bool skip = false)
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 re. the 'skip' parameter
446
      if (t->type == tok_operator && t->content == "@define" && skip == false)
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 preprocessor token in 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 (true);
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 (+127 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 temporary directory writable by any user potentially involved
9
MYTMPD=$( mktemp -d )
10
MYSTPM=$MYTMPD/PR18462.stpm
11
12
export SYSTEMTAP_TAPSET=$MYTMPD
13
14
# basic tests
15
# ______________________________________________________________________________
16
17
cat > $MYSTPM <<EOF01
18
@define __testmacro %( 7 %)
19
EOF01
20
21
stap -p1 - <<EOF02
22
probe begin { println(@__testmacro) }
23
EOF02
24
25
cat > $MYSTPM <<EOF03
26
%( 1 == 1 %?
27
@define __testmacroA %( 7 %)
28
%:
29
@define __testmacroB %( 7 %)
30
%)
31
EOF03
32
33
stap -p1 - <<EOF04
34
probe begin { println(@__testmacroA) }
35
EOF04
36
37
! stap -p1 - <<EOF05
38
probe begin { println(@__testmacroB) }
39
EOF05
40
41
cat > $MYSTPM <<EOF06
42
%( "a" == "b" %?
43
@define __testmacroC %( 7 %)
44
%:
45
@define __testmacroD %( 7 %)
46
%)
47
EOF06
48
49
! stap -p1 - <<EOF07
50
probe begin { println(@__testmacroC) }
51
EOF07
52
53
stap -p1 - <<EOF08
54
probe begin { println(@__testmacroD) }
55
EOF08
56
57
# both the true and false side of a conditional are defining the same macro name
58
# ______________________________________________________________________________
59
60
cat > $MYSTPM <<EOF09
61
%( 1 == 1 %?
62
@define __testmacroE %( 7 %)
63
%:
64
@define __testmacroE %( 9 %)
65
%)
66
EOF09
67
68
stap -p1 - <<EOF10
69
probe begin { println(@__testmacroE) }
70
EOF10
71
72
cat > $MYSTPM <<EOF11
73
%( 1 != 1 %?
74
@define __testmacroF %( 7 %)
75
%:
76
@define __testmacroF %( 9 %)
77
%)
78
EOF11
79
80
stap -p1 - <<EOF12
81
probe begin { println(@__testmacroF) }
82
EOF12
83
84
# test nested conditionals
85
# ______________________________________________________________________________
86
87
cat > $MYSTPM <<EOF13
88
%( 1 == 1 %?
89
  %( 1 == 1 %?
90
    @define __testmacroG %( 7 %)
91
  %:
92
    @define __testmacroH %( 7 %)
93
  %)
94
%:
95
@define __testmacroI %( 7 %)
96
%)
97
EOF13
98
99
stap -p1 - <<EOF14
100
probe begin { println(@__testmacroG) }
101
EOF14
102
103
! stap -p1 - <<EOF15
104
probe begin { println(@__testmacroH) }
105
EOF15
106
107
! stap -p1 - <<EOF16
108
probe begin { println(@__testmacroI) }
109
EOF16
110
111
# test some expected errors
112
# ______________________________________________________________________________
113
114
# incomplete conditional at end of file
115
cat > $MYSTPM <<EOF17
116
%( 1 == 1 %?
117
@define __testmacroJ %( 7 %)
118
EOF17
119
120
! stap -p1 - <<EOF18
121
probe begin { println(@__testmacroJ) }
122
EOF18
123
124
rm -f $MYSTPM
125
126
set +e
127

Return to bug 18462