public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "mcermak at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug tapsets/20136] New: Use the @const() operator across the tapset scripts.
Date: Tue, 24 May 2016 09:43:00 -0000	[thread overview]
Message-ID: <bug-20136-6586@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2016-05-24  9:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24  9:43 mcermak at redhat dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-20136-6586@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).