[PATCH] linker_set.h: Add alignof implementation for when not C11 or C++11

Joel Sherrill joel at rtems.org
Wed Jul 21 21:55:49 UTC 2021


On Wed, Jul 21, 2021, 4:31 PM Gedare Bloom <gedare at rtems.org> wrote:

> This seems alright to me. At least, it should get some complaints
> quickly if it doesn't work :)
>

The old version should have gotten complaints but didn't. Probably
indicates people are not being careful about specifying the language
version they want to use and just taking the GCC default which periodically
changes.

--joel

>
> On Tue, Jul 20, 2021 at 3:04 PM Joel Sherrill <joel at rtems.org> wrote:
> >
> > The default implementation was completely broken. Use the GCC specific
> > __alignof__ if compiling for C99 or C++03. If not C++11, C11, or
> > GCC, then it is an error.
> > ---
> >  freebsd/sys/sys/linker_set.h | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/freebsd/sys/sys/linker_set.h b/freebsd/sys/sys/linker_set.h
> > index baa5ae4..9af5307 100755
> > --- a/freebsd/sys/sys/linker_set.h
> > +++ b/freebsd/sys/sys/linker_set.h
> > @@ -73,8 +73,10 @@
> >    #define RTEMS_BSD_ALIGNOF( _type_name ) alignof( _type_name )
> >  #elif __STDC_VERSION__ >= 201112L
> >    #define RTEMS_BSD_ALIGNOF( _type_name ) _Alignof( _type_name )
> > +#elif defined(__GNUC__)
> > +  #define RTEMS_BSD_ALIGNOF( _type_name ) __alignof__( _type_name )
> >  #else
> > -  #define RTEMS_BSD_ALIGNOF( _type_name ) sizeof( _type_name )
> > +  #error "FIX ME! Implement RTEMS_BSD_ALIGNOF() for this environment"
> >  #endif
> >
> >  #define RTEMS_BSD_SET_ALIGN( type )    \
> > --
> > 1.8.3.1
> >
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210721/0eb9a4e8/attachment-0001.html>


More information about the devel mailing list