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

Re: [PATCH 0/2] Fix syntax errors under clang 11.0.0 on MacOS

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
Oct 7, 2022, 15:19 UTC
Message-ID
<0f67ca77-f17f-d844-e689-ca9a9bdf7993@jeffhostetler.com>
In-Reply-To
<pull.1375.git.1665085395.gitgitgadget@gmail.com>
On 10/6/22 3:43 PM, Jeff Hostetler via GitGitGadget wrote:
Show 5 quoted lines
> This patch series fixes three syntax errors that caused compiler errors with
> clang 11.0.0 on MacOS. I've included the error/warning messages in the
> commit messages. The offending statements did compile successfully under
> clang 14.0.0 on MacOS, so I have to assume that this usage is newer than
> what clang 11 supports.
[...]

I didn't realize that these variable initialization fixes would spawn such a large response here [1]. Nor that it had been already discussed in great length in [2] in July.

I'm not sure how to best proceed here.
* I'm not sure these fixes are important enough to warrant the
   engineering time to hack up the Makefile or config.mak.uname
   to conditionally turn off -Wno-missing-braces based on some
   {platform-os-version, gcc/clang-version} combination.
* While -Wno-missing-braces option may prevent the warning/error
   (depending on -Werror) for these "{0}" should be "{{0}}"
   errors, do we know that this won't hide real problems.  (I mean
   we tend to only see it for these {0} / {{0}} false alarms, but
   I'd hate to lose the protection for non-false alarms.)
* The suggestion to use a <type>_INIT macro to hide the {0} or
   {{0}} may help in the:
         xmparam_t xmp = XMPARAM_INIT;
   case, but in the `mmfile_t mmfs[3]` case, we have an array of
   that type, so we'd need something like:
      mmfile_t mmfs[3] = { MMFILE_INIT }; or
      mmfile_t mmfs[3] = MMFILE_INIT_ARRAY;
   for the macros to make sense.
   I'm not sure either of these two is better than just writing "{{0}}".
* I wasn't sure which compiler versions we *want* to support or
   want to drop support for.
   * I've only thought about it in the context of clang on MacOS.
   * Clang 11 (from what I can tell (without looking too hard))
     comes with the version of XCode that runs on MacOS 10.15
     Catalina.  (In contrast, clang 14 comes with the version of
     XCode that runs on MacOS 12.6 Monterey.)
   * I can't comment on other old-ish compilers on other platforms.
* I'm not the first one who has stumbled over this and had to
   rediscover the solution.  So I'd hate to just kick this down
   the road some more, but then again I'd hate to waste a lot of
   time on it -- for very little actual functional value.
* Is "{{0}}" really that ugly ???
So as I said earlier, I'm not sure how to proceed here.
Jeff

[1] https://lore.kernel.org/git/pull.1375.git.1665085395.gitgitgadget@gmail.com/

[2] https://lore.kernel.org/git/365e01e93dce582e9d926e83bdc6891310d22699.1659084832.git.congdanhqx@gmail.com/

Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 10 of 21 in “Fix syntax errors under clang 11.0.0 on MacOS”
  1. 0/2 Fix syntax errors under clang 11.0.0 on MacOSJeff Hostetler via GitGitGadget, Oct 6, 2022
  2. 1/2 builtin/merge-file: fix compiler error on MacOS with clang 11.0.0Jeff Hostetler via GitGitGadget, Oct 6, 2022
  3. René ScharfeOct 6, 2022
  4. Eric SunshineOct 6, 2022
  5. Junio C HamanoOct 6, 2022
  6. 2/2 builtin/unpack-objects.c: fix compiler error on MacOS with clang 11.0.0Jeff Hostetler via GitGitGadget, Oct 6, 2022
  7. Junio C HamanoOct 6, 2022
  8. Eric SunshineOct 6, 2022
  9. Ævar Arnfjörð BjarmasonOct 7, 2022
  10. Jeff HostetlerOct 7, 2022
  11. Junio C HamanoOct 7, 2022
  12. René ScharfeOct 7, 2022
  13. Jeff HostetlerOct 7, 2022
  14. Junio C HamanoOct 7, 2022
  15. Eric SunshineOct 8, 2022
  16. René ScharfeOct 8, 2022
  17. Junio C HamanoOct 9, 2022
  18. Junio C HamanoOct 7, 2022
  19. config.mak.dev: disable suggest braces error on old clang versionsJeff Hostetler via GitGitGadget, Oct 10, 2022
  20. Junio C HamanoOct 10, 2022
  21. Junio C HamanoOct 11, 2022

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.