This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Retrieving argument value from __attribute__


2013/2/25 naga raj <gnuuser.raj@gmail.com>:
> Hi All,
>
>    I am working on Microblaze port. I have a requirement in which user
> will declare a handler number in the function prototype as below
>    ex: void matrix_const(int ) __attribute__((svc_handler(777)));
>
[deleted]
>
> My question is how to find the argument value(777) using
> "microblaze_svc_handler_function_p" ?? Do we have any ATTRIBUTE
> related function to do this.
>  Please suggest a solution/document by which we can extract the
> argument value...
>
>
> Thanks in Advance,
> Nagaraju

Try following statement:

  tree attrs;
  tree name, args;

  attrs = DECL_ATTRIBUTES (func);
  name  = TREE_PURPOSE (attrs);
  args  = TREE_VALUE (attrs);


After that, you can use:

  TREE_INT_CST_LOW (TREE_VALUE (args))

to extract its constant value.


Best regards,
jasonwucj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]