git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 3/8] diff-delta.c: "delta.h" is not a required include

From
Brandon Casey <drafnel@gmail.com>
Date
Jun 6, 2009, 03:56 UTC
Message-ID
<ee63ef30906052056le082bffrec078981dddaa013@mail.gmail.com>
In-Reply-To
<alpine.LFD.2.00.0906052302550.3906@xanadu.home>
On Fri, Jun 5, 2009 at 10:10 PM, Nicolas Pitre<nico@cam.org> wrote:
Show 57 quoted lines
> On Fri, 5 Jun 2009, Brandon Casey wrote:
>
>> Nicolas Pitre wrote:
>> > On Fri, 5 Jun 2009, Brandon Casey wrote:
>> >
>> >> From: Brandon Casey <drafnel@gmail.com>
>> >>
>> >> When compiling diff-delta.c with the SUNWspro C99 compiler, it complains
>> >>
>> >>     "diff-delta.c", line 314: identifier redeclared: create_delta
>> >>
>> >> There is nothing in "delta.h" that is required by diff-delta.c, so don't
>> >> include it.
>> >>
>> >> Signed-off-by: Brandon Casey <drafnel@gmail.com>
>> >
>> > NAK.
>> >
>> > This is common practice to include the header file declaring function
>> > prototypes into the file defining the actual function so to make sure
>> > the declaration matches with the definition.  Deleting that include is
>> > actively ignoring a problem instead of fixing the cause of it.
>>
>>
>> It doesn't seem to like the structure being redeclared with a flex array
>> member and being passed as a const argument.
>>
>>
>> # cat > test.c <<EOF
>>
>> struct a_struct;
>>
>> extern void *test_func(const struct a_struct *f);
>>
>> struct a_struct {
>>         int a;
>>         int b;
>>         char* c[];
>> };
>>
>> void *test_func(const struct a_struct *f)
>> {
>>         return 0;
>> }
>> EOF
>>
>> # /opt/SUNWspro/bin/c99 -c test.c
>> "test.c", line 13: identifier redeclared: test_func
>>         current : function(pointer to const struct a_struct {int a, int b, array[-1] of pointer to char c}) returning pointer to void
>>         previous: function(pointer to const struct a_struct {int a, int b, array[-1] of pointer to char c}) returning pointer to void : "test.c", line 4
>> c99: acomp failed for test.c
>>
>>
>> If either the flex array is removed from the structure, or const is removed from
>> test_func argument, test.c will compile.  Compiling with -O0 doesn't help.
>
> What if you define FLEX_ARRAY to 1, or even 0?

I tried that with my test.c example and '1' works, but not '0'. I'll try setting FLEX_ARRAY to 1 and running git's test suite on Monday.

Show 5 quoted lines
> If neither of those work then I'd simply remove the const.  Generated
> code should be exactly the same with gcc.  There is no const with
> sizeof_delta_index() which is already inconsistent.
>
> Kind of weird nevertheless.
Yes.
-brandon
Previous: Nicolas PitreNext: Brandon Casey
Message 22 of 30 in “enhancing builds on Solaris”
  1. 0/8 enhancing builds on SolarisBrandon Casey, Jun 5, 2009
  2. 1/8 Makefile: use /usr/ucb/install on SunOS platforms rather than ginstallBrandon Casey, Jun 5, 2009
  3. 2/8 Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile argumentsBrandon Casey, Jun 5, 2009
  4. 3/8 diff-delta.c: "diff.h" is not a required includeBrandon Casey, Jun 5, 2009
  5. 4/8 On Solaris choose the OLD_ICONV iconv() declaration based on the UNIX specBrandon Casey, Jun 5, 2009
  6. 5/8 git-compat-util.h: tweak the way _XOPEN_SOURCE is set on SolarisBrandon Casey, Jun 5, 2009
  7. 6/8 Makefile: define __sun__ on SunOSBrandon Casey, Jun 5, 2009
  8. 7/8 Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATHBrandon Casey, Jun 5, 2009
  9. 8/8 Makefile: add section for SunOS 5.7Brandon Casey, Jun 5, 2009
  10. Jeff KingJun 8, 2009
  11. Brandon CaseyJun 8, 2009
  12. Jeff KingJun 8, 2009
  13. Brandon CaseyJun 8, 2009
  14. Junio C HamanoJun 8, 2009
  15. Jeff KingJun 8, 2009
  16. Brandon CaseyJun 8, 2009
  17. Brandon CaseyJun 9, 2009
  18. 3/8 diff-delta.c: "delta.h" is not a required includeBrandon Casey, Jun 6, 2009
  19. Nicolas PitreJun 6, 2009
  20. Brandon CaseyJun 6, 2009
  21. Nicolas PitreJun 6, 2009
  22. Brandon CaseyJun 6, 2009
  23. git-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8Brandon Casey, Jun 8, 2009
  24. Jakub NarebskiJun 6, 2009
  25. Brandon CaseyJun 7, 2009
  26. configure: test whether -lresolv is neededRalf Wildenhues, Jun 7, 2009
  27. Brandon CaseyJun 5, 2009
  28. Junio C HamanoJun 6, 2009
  29. Brandon CaseyJun 6, 2009
  30. Jeff KingJun 8, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.