From 27b829ee701e29804216b3803fbaeb629be27491 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 29 Jan 2014 13:46:39 +0000 Subject: Following up on Tom's suggestion I am checking in a patch to replace the various bfd_xxx_set macros with static inline functions, so that we can avoid compile time warnings about comma expressions with unused values. * bfd-in.h (bfd_set_section_vma): Delete. (bfd_set_section_alignment): Delete. (bfd_set_section_userdata): Delete. (bfd_set_cacheable): Delete. * bfd.c (bfd_set_cacheable): New static inline function. * section.c (bfd_set_section_userdata): Likewise. (bfd_set_section_vma): Likewise. (bfd_set_section_alignment): Likewise. * bfd-in2.h: Regenerate. --- bfd/section.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'bfd/section.c') diff --git a/bfd/section.c b/bfd/section.c index fb19d8c..a661228 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -542,6 +542,32 @@ CODE_FRAGMENT . int size; .}; . +.{* Note: the following are provided as inline functions rather than macros +. because not all callers use the return value. A macro implementation +. would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some +. compilers will complain about comma expressions that have no effect. *} +.static inline bfd_boolean +.bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val) +.{ +. ptr->userdata = val; +. return TRUE; +.} +. +.static inline bfd_boolean +.bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) +.{ +. ptr->vma = ptr->lma = val; +. ptr->user_set_vma = TRUE; +. return TRUE; +.} +. +.static inline bfd_boolean +.bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val) +.{ +. ptr->alignment_power = val; +. return TRUE; +.} +. .{* These sections are global, and are managed by BFD. The application . and target back end are not permitted to change the values in . these sections. *} -- cgit v1.1