FreeBSD/sys/contrib/dev/acpica/compiler/aslanalyze.c
/*******************************************************************************
 *
 * FUNCTION:    AnCheckMethodReturnValue
 *
 * PARAMETERS:  Op                  - Parent
 *              OpInfo              - Parent info
 *              ArgOp               - Method invocation op
 *              RequiredBtypes      - What caller requires
 *              ThisNodeBtype       - What this node returns (if anything)
 *
 * RETURN:      None
 *
 * DESCRIPTION: Check a method invocation for 1) A return value and if it does
 *              in fact return a value, 2) check the type of the return value.
 *
 ******************************************************************************/


None

Check a method invocation for 1) A return value and if it does
in fact return a value, 2) check the type of the return value.
None Check a method invocation for 1 ) A return value and if it does in fact return a value 2 ) check the type of the return value .
void
AnCheckMethodReturnValue (
    ACPI_PARSE_OBJECT       *Op,
    const ACPI_OPCODE_INFO  *OpInfo,
    ACPI_PARSE_OBJECT       *ArgOp,
    UINT32                  RequiredBtypes,
    UINT32                  ThisNodeBtype)
{
    ACPI_PARSE_OBJECT       *OwningOp;
    ACPI_NAMESPACE_NODE     *Node;
    Node = ArgOp->Asl.Node;
    if (!Node)
    {
        return;
    }
    OwningOp = Node->Op;
    if (OwningOp->Asl.CompileFlags & NODE_METHOD_NO_RETVAL)
    {
        AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, Op->Asl.ExternalName);
    }
    else if (OwningOp->Asl.CompileFlags & NODE_METHOD_SOME_NO_RETVAL)
    {
        AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL,
            Op, Op->Asl.ExternalName);
    }
    else if (!(ThisNodeBtype & RequiredBtypes))
    {
        AnFormatBtype (StringBuffer, ThisNodeBtype);
        AnFormatBtype (StringBuffer2, RequiredBtypes);
        if (ThisNodeBtype != 0)
        {
            sprintf (MsgBuffer,
                "Method returns [%s], %s operator requires [%s]",
                StringBuffer, OpInfo->Name, StringBuffer2);
            AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer);
        }
    }
}
void AnCheckMethodReturnValue ( ACPI_PARSE_OBJECT * Op , const ACPI_OPCODE_INFO * OpInfo , ACPI_PARSE_OBJECT * ArgOp , UINT32 RequiredBtypes , UINT32 ThisNodeBtype ) { ACPI_PARSE_OBJECT * OwningOp ; ACPI_NAMESPACE_NODE * Node ; Node = ArgOp -> Asl . Node ; if ( ! Node ) { return ; } OwningOp = Node -> Op ; if ( OwningOp -> Asl . CompileFlags & NODE_METHOD_NO_RETVAL ) { AslError ( ASL_ERROR , ASL_MSG_NO_RETVAL , Op , Op -> Asl . ExternalName ) ; } else if ( OwningOp -> Asl . CompileFlags & NODE_METHOD_SOME_NO_RETVAL ) { AslError ( ASL_WARNING , ASL_MSG_SOME_NO_RETVAL , Op , Op -> Asl . ExternalName ) ; } else if ( ! ( ThisNodeBtype & RequiredBtypes ) ) { AnFormatBtype ( StringBuffer , ThisNodeBtype ) ; AnFormatBtype ( StringBuffer2 , RequiredBtypes ) ; if ( ThisNodeBtype != 0 ) { sprintf ( MsgBuffer , " " , StringBuffer , OpInfo -> Name , StringBuffer2 ) ; AslError ( ASL_ERROR , ASL_MSG_INVALID_TYPE , ArgOp , MsgBuffer ) ; } } }
FUNCTION:    AnCheckMethodReturnValue
 PARAMETERS:  Op                  - Parent
              OpInfo              - Parent info
              ArgOp               - Method invocation op
              RequiredBtypes      - What caller requires
              ThisNodeBtype       - What this node returns (if anything)
FUNCTION : AnCheckMethodReturnValue PARAMETERS : Op - Parent OpInfo - Parent info ArgOp - Method invocation op RequiredBtypes - What caller requires ThisNodeBtype - What this node returns ( if anything )
/* No error message, this can happen and is OK */ /* Examine the parent op of this method */ /* Method NEVER returns a value */ /* Method SOMETIMES returns a value, SOMETIMES not */ /* Method returns a value, but the type is wrong */ /*
         * The case where the method does not return any value at all
         * was already handled in the namespace cross reference
         * -- Only issue an error if the method in fact returns a value,
         * but it is of the wrong type
         */