This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tapsets/20136] New: Use the @const() operator across the tapset scripts.


https://sourceware.org/bugzilla/show_bug.cgi?id=20136

            Bug ID: 20136
           Summary: Use the @const() operator across the tapset scripts.
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tapsets
          Assignee: systemtap at sourceware dot org
          Reporter: mcermak at redhat dot com
  Target Milestone: ---

PR19926 adds a new @const() operator to the translator.  Attached patch is a
kick-off attempt to use @const() across the tapset scripts where possible. 
It's rather large.  It went through one round of testing and fixing on my side
and now seems to test fine.  In some cases it changes/extends the original
annotations, but hopefully in a reasonable way.

There might be more opportunities to use @const() in the tapset scripts. 
Notably I've been looking at bodies of stp_pid(), tz_gmtoff(), and tz_name()
(which is a /* string */).  I've been rather conservative.

However, I see one problem: The attached patch doesn't have one particular
update that I'd like to do, but can't:  In tapset/macros.stpm, there is a
MAXSTRINGLEN macro. It looks like a promising candidate for an update similar
to this:

=======
diff --git a/tapset/macros.stpm b/tapset/macros.stpm                            
index fc86cff..6f8cfec 100644                                                   
--- a/tapset/macros.stpm                                                        
+++ b/tapset/macros.stpm                                                        
@@ -1,7 +1,7 @@                                                                 
 // Return MAXSTRINGLEN                                                         
 @define MAXSTRINGLEN                                                           
 %(                                                                             
-       %{ /* pure */ /* unprivileged */ MAXSTRINGLEN %}                        
+       @const("MAXSTRINGLEN")                                                  
 %)                                                                             

 @define __compat_task
=======

But such update makes semok/autocast07.stp unhappy:

=======
#  stap -vv -p2 semok/autocast07.stp
[ ... stuff deleted ... ]
semantic error: while processing function user_string
   thrown from: ../src/elaborate.cxx:5412
semantic error: unexpected @const: operator '@const' at
/usr/local/share/systemtap/tapset/macros.stpm:4:2
   thrown from: ../src/elaborate.cxx:5985
        source:         @const("MAXSTRINGLEN")
                        ^
        in expansion of macro: operator '@MAXSTRINGLEN' at
/usr/local/share/systemtap/tapset/uconversions.stp:44:2
        source:         return user_string_n(addr, @MAXSTRINGLEN)
                                                   ^
=======

(Notes for myself: The above exception gets initially thrown from
typeresolution_info::visit_const_op(), elaborate.cxx:5983.  Disabling this
check causes 'unresolved type : operator '@const'.)

I am not sure whether the above update to macros.stpm is something the
translator should support or not.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]