[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] [PATCH 5/8] NITEMS definition cleanup.
From: |
Robert Norris |
Subject: |
Re: [gpsd-dev] [PATCH 5/8] NITEMS definition cleanup. |
Date: |
Thu, 21 Apr 2016 22:37:03 +0100 |
> Date: Wed, 20 Apr 2016 13:07:20 -0700
> From: address@hidden
> To: address@hidden
> CC: address@hidden
> Subject: Re: [gpsd-dev] [PATCH 5/8] NITEMS definition cleanup.
>
> Yo Robert!
>
> On Wed, 20 Apr 2016 01:25:05 +0100
> Robert Norris <address@hidden> wrote:
>
>> In moving to a more rigorous split between libgpsd and libgps, there
>> currently exists NITEMS definitions in both sections - so it gpsd
>> itself defining more than once.
>
> Moving to one definition is a good thing.
>
>> Here instead of creating a single definition, I moved one to be
>> visible somewhere to provide for the libgps side.
>
> So, half right.
>
>> However libgps.h gets used with libgpsd so one would get compiler
>> redefinition warnings.
>
> How about solving it the right way? A single header file in common
> with both sides, things things ony get defined once.
>
>> Perhaps creating a single version (e.g. in the new gpsd_definitons.h
>> file or similar) would be better.
>
> Yup.
>
> As a rule, when you define something twice, they will eventually get out
> of sync.
>
I remember now another detail:
Unfortunately the NITEMS definition uses COMPILE_CHECK_IS_ARRAY, which is
defined in compiler.h
compiler.h includes gpsd_config.h
So putting NITEMS into gpsd_config.h (or into a new file) leads to circular
definitions, hence I gave up on having a single definition and went for
sticking it in libgps.h.