[PATCH 2/2] main_dd.c: Eliminate no prototype warning for swab()

Joel Sherrill joel at rtems.org
Mon Aug 28 15:12:20 UTC 2017


On Mon, Aug 28, 2017 at 9:39 AM, Gedare Bloom <gedare at rtems.org> wrote:

> On Sun, Aug 27, 2017 at 5:02 PM, Joel Sherrill <joel at rtems.org> wrote:
> > ---
> >  cpukit/libmisc/shell/main_dd.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/cpukit/libmisc/shell/main_dd.c b/cpukit/libmisc/shell/main_
> dd.c
> > index e9c8bf3..6ae4abb 100644
> > --- a/cpukit/libmisc/shell/main_dd.c
> > +++ b/cpukit/libmisc/shell/main_dd.c
> > @@ -73,6 +73,17 @@ __FBSDID("$FreeBSD: src/bin/dd/dd.c,v 1.43 2004/08/15
> 19:10:05 rwatson Exp $");
> >  #include <string.h>
> >  #include <unistd.h>
> >
> > +#ifdef __rtems__
> > +/*
> > + * We should be able to define _XOPEN_SOURCE=900 to get a prototype for
> > + * swab() but if that is defined before including <rtems.h>, then the
> RTEMS
> > + * headers don't compile. If defined after including <rtems.h>, then
> > + * it still doesn't trip the include. Thus this prototype.
> > + */
> Why don't the rtems headers compile?
>
>
Looks like rtems.h needs BSD stuff enabled to know the core time types.
When
you add _XOPEN_SOURCE 900, it doesn't compile. If you add it immediately
below rtems.h, then it doesn't have any impact.

Try removing the warning for a few minutes yourself and see if you have
any insight. My hunch is that this hints at something ugly.


> I don't see a patch 1/2.
>

I was working on a branch and the other patch was an obvious warning fix
so I committed it directly.

I posted this one because it is definitely more of a hack and hints at
some weird underlying header file issue.


>
> > +
> > +void swab(const void *from, void *to, ssize_t n);
> > +#endif
> > +
> >  #include "dd.h"
> >  #include "extern-dd.h"
> >
> > --
> > 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/20170828/6e0094a5/attachment.html>


More information about the devel mailing list