diff mbox series

[v3,3/3] commit-slab: missing definitions and forward declarations (hdr-check)

Message ID 20181025110427.13655-4-carenas@gmail.com (mailing list archive)
State New, archived
Headers show
Series delta-islands: avoid unused function messages | expand

Commit Message

Carlo Marcelo Arenas Belón Oct. 25, 2018, 11:04 a.m. UTC
struct commmit needs to be defined before commit-slab can generate
working code, object_id should be at least known through a forward
declaration

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 commit-slab-impl.h | 2 ++
 commit-slab.h      | 2 ++
 2 files changed, 4 insertions(+)

Comments

Ramsay Jones Oct. 25, 2018, 6:54 p.m. UTC | #1
On 25/10/2018 12:04, Carlo Marcelo Arenas Belón wrote:
> struct commmit needs to be defined before commit-slab can generate
> working code, object_id should be at least known through a forward
> declaration
> 
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  commit-slab-impl.h | 2 ++
>  commit-slab.h      | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/commit-slab-impl.h b/commit-slab-impl.h
> index e352c2f8c1..db7cf3f19b 100644
> --- a/commit-slab-impl.h
> +++ b/commit-slab-impl.h
> @@ -1,6 +1,8 @@
>  #ifndef COMMIT_SLAB_IMPL_H
>  #define COMMIT_SLAB_IMPL_H
>  
> +#include "commit.h"
> +
>  #define implement_static_commit_slab(slabname, elemtype) \
>  	implement_commit_slab(slabname, elemtype, MAYBE_UNUSED static)
>  
> diff --git a/commit-slab.h b/commit-slab.h
> index 69bf0c807c..722252de61 100644
> --- a/commit-slab.h
> +++ b/commit-slab.h
> @@ -1,6 +1,8 @@
>  #ifndef COMMIT_SLAB_H
>  #define COMMIT_SLAB_H
>  
> +struct object_id;
> +
>  #include "commit-slab-decl.h"
>  #include "commit-slab-impl.h"
>  
> 

Hmm, sorry, I don't see how this patch has anything to do
with the other two patches! ;-)

Also, I have a patch to fix up the 'commit-reach.h' header
(it was part of my original series, just had to update the
commit message), which adds these very #includes and forward
declarations when _using_ the commit-slab.

I haven't tried applying your patches yet, which may answer
my questions, so I am a little puzzled.

ATB,
Ramsay Jones
Ramsay Jones Oct. 25, 2018, 9:08 p.m. UTC | #2
On 25/10/2018 19:54, Ramsay Jones wrote:
> 
> 
> On 25/10/2018 12:04, Carlo Marcelo Arenas Belón wrote:
>> struct commmit needs to be defined before commit-slab can generate
>> working code, object_id should be at least known through a forward
>> declaration
>>
>> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
>> ---
>>  commit-slab-impl.h | 2 ++
>>  commit-slab.h      | 2 ++
>>  2 files changed, 4 insertions(+)
>>
>> diff --git a/commit-slab-impl.h b/commit-slab-impl.h
>> index e352c2f8c1..db7cf3f19b 100644
>> --- a/commit-slab-impl.h
>> +++ b/commit-slab-impl.h
>> @@ -1,6 +1,8 @@
>>  #ifndef COMMIT_SLAB_IMPL_H
>>  #define COMMIT_SLAB_IMPL_H
>>  
>> +#include "commit.h"
>> +
>>  #define implement_static_commit_slab(slabname, elemtype) \
>>  	implement_commit_slab(slabname, elemtype, MAYBE_UNUSED static)
>>  
>> diff --git a/commit-slab.h b/commit-slab.h
>> index 69bf0c807c..722252de61 100644
>> --- a/commit-slab.h
>> +++ b/commit-slab.h
>> @@ -1,6 +1,8 @@
>>  #ifndef COMMIT_SLAB_H
>>  #define COMMIT_SLAB_H
>>  
>> +struct object_id;
>> +
>>  #include "commit-slab-decl.h"
>>  #include "commit-slab-impl.h"
>>  
>>
> 
> Hmm, sorry, I don't see how this patch has anything to do
> with the other two patches! ;-)
> 
> Also, I have a patch to fix up the 'commit-reach.h' header
> (it was part of my original series, just had to update the
> commit message), which adds these very #includes and forward
> declarations when _using_ the commit-slab.
> 
> I haven't tried applying your patches yet, which may answer
> my questions, so I am a little puzzled.

So, having now applied your patches, I still don't see what this
patch has to do with the others! I suppose it is dependent on the
compiler/version? (the most up-to-date version of clang available
to me is 5.0.1).

Yes, this will 'fix' the 'commit-reach.h' header (not surprising),
but I prefer my patch. ;-)

Still puzzled.

ATB,
Ramsay Jones
Carlo Marcelo Arenas Belón Oct. 26, 2018, 3:15 a.m. UTC | #3
On Thu, Oct 25, 2018 at 2:09 PM Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
> Yes, this will 'fix' the 'commit-reach.h' header (not surprising),
> but I prefer my patch. ;-)

I apologize, I joined the list recently and so might had missed a
reroll; the merged series in pu doesn't seem to include it and the
error was around the code I changed, so wanted to make sure it would
be addressed sooner rather than later.

eitherway, I agree with you my patch (or something better) would fit
better in your topic branch than on mine and while I haven't seen your
patch I am sure is most likely better.

> Still puzzled.

this are the last lines of a `make hdr-check` in Fedora Rawhide, it
should behave the same regardless of OS or compiler used IMHO

    HDR commit-reach.h
commit-reach.h:45:28: warning: ‘struct object_id’ declared inside
parameter list will not be visible outside of this definition or
declaration
 int ref_newer(const struct object_id *new_oid, const struct object_id
*old_oid);
                            ^~~~~~~~~
In file included from commit-slab.h:5,
                 from commit-reach.h:4:
commit-reach.h: In function ‘contains_cache_at_peek’:
commit-slab-impl.h:47:14: error: dereferencing pointer to incomplete
type ‘const struct commit’
  nth_slab = c->index / s->slab_size;    \
              ^~
commit-slab-impl.h:7:2: note: in expansion of macro ‘implement_commit_slab’
  implement_commit_slab(slabname, elemtype, static MAYBE_UNUSED)
  ^~~~~~~~~~~~~~~~~~~~~
commit-slab.h:49:2: note: in expansion of macro ‘implement_static_commit_slab’
  implement_static_commit_slab(slabname, elemtype)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
commit-reach.h:57:1: note: in expansion of macro ‘define_commit_slab’
 define_commit_slab(contains_cache, enum contains_result);
 ^~~~~~~~~~~~~~~~~~
commit-reach.h: At top level:
commit-reach.h:69:41: warning: ‘struct object_array’ declared inside
parameter list will not be visible outside of this definition or
declaration
 int can_all_from_reach_with_flag(struct object_array *from,
                                         ^~~~~~~~~~~~
make: *** [Makefile:2685: commit-reach.hco] Error 1

Carlo
Ramsay Jones Oct. 27, 2018, 1:45 a.m. UTC | #4
On 26/10/2018 04:15, Carlo Arenas wrote:
> On Thu, Oct 25, 2018 at 2:09 PM Ramsay Jones
> <ramsay@ramsayjones.plus.com> wrote:
>> Yes, this will 'fix' the 'commit-reach.h' header (not surprising),
>> but I prefer my patch. ;-)
> 
> I apologize, I joined the list recently and so might had missed a
> reroll; the merged series in pu doesn't seem to include it and the
> error was around the code I changed, so wanted to make sure it would
> be addressed sooner rather than later.
> 
> eitherway, I agree with you my patch (or something better) would fit
> better in your topic branch than on mine and while I haven't seen your
> patch I am sure is most likely better.

Hmm, I don't know about that!

Since the original series has progressed, any additions will now
result in a new set of patches, rather than a re-roll.

The original 'commit-reach.h' patch was not applied as part of the
last series, since the commit message was felt to be lacking (well,
it was actually non-existent!). ;-)

I have been making some additional changes to the 'hdr-check' target
in the Makefile, but I haven't quite finished. I will send the other
(non-Makefile) changes soon. [These patches will make the 'master'
and 'next' branches 'hdr-check' clean for me].

ATB,
Ramsay Jones
diff mbox series

Patch

diff --git a/commit-slab-impl.h b/commit-slab-impl.h
index e352c2f8c1..db7cf3f19b 100644
--- a/commit-slab-impl.h
+++ b/commit-slab-impl.h
@@ -1,6 +1,8 @@ 
 #ifndef COMMIT_SLAB_IMPL_H
 #define COMMIT_SLAB_IMPL_H
 
+#include "commit.h"
+
 #define implement_static_commit_slab(slabname, elemtype) \
 	implement_commit_slab(slabname, elemtype, MAYBE_UNUSED static)
 
diff --git a/commit-slab.h b/commit-slab.h
index 69bf0c807c..722252de61 100644
--- a/commit-slab.h
+++ b/commit-slab.h
@@ -1,6 +1,8 @@ 
 #ifndef COMMIT_SLAB_H
 #define COMMIT_SLAB_H
 
+struct object_id;
+
 #include "commit-slab-decl.h"
 #include "commit-slab-impl.h"