mirror of
https://github.com/acpica/acpica/
synced 2025-02-24 17:34:43 +03:00
iASL: Mark Return() and Return as "Null" return statements.
Since the parser stuffs a "zero" as the return value for these statements (due to the AML grammar), they were seen as "return with value" by the semantic checking. They are now seen correctly as "null" return statements.
This commit is contained in:
parent
8b3f242f8d
commit
a35e8b2438
@ -1556,7 +1556,7 @@ ReturnTerm
|
||||
: PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);}
|
||||
OptionalReturnArg
|
||||
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
|
||||
| PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrCreateLeafNode (PARSEOP_ZERO));}
|
||||
| PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
|
||||
| PARSEOP_RETURN '('
|
||||
error ')' {$$ = AslDoError(); yyclearin;}
|
||||
;
|
||||
@ -3133,7 +3133,7 @@ OptionalTermArg
|
||||
;
|
||||
|
||||
OptionalReturnArg
|
||||
: {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
|
||||
: {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */
|
||||
| TermArg {$$ = $1;}
|
||||
;
|
||||
|
||||
|
@ -148,6 +148,7 @@
|
||||
#define NODE_COMPILER_EMITTED 0x00020000
|
||||
#define NODE_IS_DUPLICATE 0x00040000
|
||||
#define NODE_IS_RESOURCE_DATA 0x00080000
|
||||
#define NODE_IS_NULL_RETURN 0x00100000
|
||||
|
||||
/* Keeps information about individual control methods */
|
||||
|
||||
|
@ -374,10 +374,17 @@ AnMethodAnalysisWalkBegin (
|
||||
return (AE_ERROR);
|
||||
}
|
||||
|
||||
/* Child indicates a return value */
|
||||
|
||||
/*
|
||||
* A child indicates a possible return value. A simple Return or
|
||||
* Return() is marked with NODE_IS_NULL_RETURN by the parser so
|
||||
* that it is not counted as a "real" return-with-value, although
|
||||
* the AML code that is actually emitted is Return(0). The AML
|
||||
* definition of Return has a required parameter, so we are
|
||||
* forced to convert a null return to Return(0).
|
||||
*/
|
||||
if ((Op->Asl.Child) &&
|
||||
(Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
|
||||
(Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(!(Op->Asl.Child->Asl.CompileFlags & NODE_IS_NULL_RETURN)))
|
||||
{
|
||||
MethodInfo->NumReturnWithValue++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user