Bug 11005 - @defined() predicate for compile-time $var error catching
Summary: @defined() predicate for compile-time $var error catching
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 enhancement
Target Milestone: ---
Assignee: Frank Ch. Eigler
URL:
Keywords:
Depends on: 10719
Blocks:
  Show dependency tree / graph
 
Reported: 2009-11-23 18:52 UTC by David Smith
Modified: 2010-03-23 21:16 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Smith 2009-11-23 18:52:03 UTC
Similar to bug #11004, it would be great if we had some syntax to tolerate
compile-time errors associated with $variable evaluation.

This would allow us to get rid of several kernel version checks and check for
$variable existence instead.  We could then turn something like this (from
syscall.poll):

====
%( kernel_vr > "2.6.15-1.1831" %?
	timeout = $timeout_msecs
%:
	timeout = $timeout
%)
====

into something like this:

====
	timeout = @catch($timeout_msecs, $timeout)
====

Where the syntax is something like '@catch($expr, $backup-expr)'.
Comment 1 Frank Ch. Eigler 2009-11-23 20:56:09 UTC
Further discussion seems to favor this syntax:

@defined($expression)  --  integer-valued, evaluated at translation time

This requires const-propagated conditionals (if else  AND  ? :) as in

    println (@defined($foo) ? $foo : $bar)
    if (@defined($bar)) { println($bar) }
Comment 2 Frank Ch. Eigler 2010-02-25 21:56:50 UTC
basic implementation complete, bug #11326 to handle an edge case