[GRASS-dev] i.landsat.toar clang compilation fails due to inline

Vaclav Petras wenzeslaus at gmail.com
Sun Oct 20 07:01:40 PDT 2013


Replacing ``inline`` by ``static`` in r58077.

Fixed according to G7: landsat_met.c:103: undefined reference to `chrncpy'
[2] where the ``chrncpy`` from the same file causes the same error and is
only ``static`` now.

``static inline`` works fine, too, but ``date_replace_slash`` does not meet
criteria for being ``inline`` specified in [2] by Glynn: It is not simple
enough (has a loop inside) and moreover, it's called only a few times (raw
guess).

Vaclav

[1] https://trac.osgeo.org/grass/changeset/58077
[2] http://lists.osgeo.org/pipermail/grass-dev/2013-July/065231.html


On Sun, Oct 20, 2013 at 8:46 AM, Markus Neteler <neteler at osgeo.org> wrote:

> On Sun, Oct 20, 2013 at 5:46 AM, Vaclav Petras <wenzeslaus at gmail.com>
> wrote:
> > Hi,
> >
> > i.landsat.toar compilation fails when compiling using clang compiler. The
> > error is:
> >
> >  undefined reference to `date_replace_slash'
> >
> > This function is defined using ``inline`` keyword:
> >
> >  inline void date_replace_slash(char *str)
> >
> > I know ``inline`` is not part of C89. However, I'm not sure about the
> fix. I
> > can fix it by replacing ``inline`` by ``__inline__``. This works for GCC
> [1]
> > and clang (should support GCC extensions) but I'm not sure about other
> > compilers (on the less usual platforms).
>
> "static" may be a viable solution. For comments on this, see also
>
> http://lists.osgeo.org/pipermail/grass-dev/2013-July/065231.html
>
> Markus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20131020/8f525ec3/attachment-0001.html>


More information about the grass-dev mailing list