bugThe libunwind project - Bugs: bug #48756, improvement: add prefix to target...

 
 

bug #48756: improvement: add prefix to target arch of preprocessor define

Submitted by:  None
Submitted on:  Thu 11 Aug 2016 01:39:13 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 11 Aug 2016 01:43:43 AM UTC, comment #1:

Submitted by furushchev

Yuki Furuta <furushchev>
Thu 11 Aug 2016 01:39:13 AM UTC, original submission:

In libunwind, function is independent on architecture by defining function as macro.

e.g. in x86_64 processor:
unw_getcontext
-> unw_tdep_getcontext
-> UNW_ARCH_OBJ(getcontext)
-> UNW_PASTE(UNW_PASTE(UNW_PASTE(U,UNW_TARGET),), getcontext)

And macro UNW_TARGET is architecture(x86_64), therefore:
-> _Ux86_64_getcontext

This technique works at the most of projects, but in some projects architecture is set directly to preprocessor as an argument "-Dx86_64".
Passing "-Dx86_64" to compiler is equivalent to:
#define x86_64 1
And this causes
#define UNW_TARGET x86_64
-> 1
So, in this case, unw_getcontext is expanded to _U1_getcontext.

I suggest that this project should has own prefix for target.
How about updating definition of preprocessor macro like:

#define UNW_TARGET _Ux86_64
#define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_TARGET,_),fn)

This never occurs any conflicts, I think.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by furushchev (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1