public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug tapsets/20136] New: Use the @const() operator across the tapset scripts.
@ 2016-05-24  9:43 mcermak at redhat dot com
  2016-05-24  9:45 ` [Bug tapsets/20136] " mcermak at redhat dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mcermak at redhat dot com @ 2016-05-24  9:43 UTC (permalink / raw)
  To: systemtap

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-05-27 19:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-24  9:43 [Bug tapsets/20136] New: Use the @const() operator across the tapset scripts mcermak at redhat dot com
2016-05-24  9:45 ` [Bug tapsets/20136] " mcermak at redhat dot com
2016-05-24 11:30 ` mcermak at redhat dot com
2016-05-24 18:35 ` fche at redhat dot com
2016-05-26  9:16 ` mcermak at redhat dot com
2016-05-27 19:36 ` mcermak at redhat dot com
2016-05-27 19:49 ` mcermak at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).