Skip to content

Fix two compiler warnings in backend unit tests - #2191

Open
tuhaihe wants to merge 1 commit into
apache:mainfrom
tuhaihe:fix-unittest-warnings
Open

tuhaihe wants to merge 1 commit into
apache:mainfrom
tuhaihe:fix-unittest-warnings

Conversation

@tuhaihe

@tuhaihe tuhaihe commented Oct 26, 2026

Copy link
Copy Markdown
Member

Compiled with the server's warning flags, two unit test sources warn:

  ginpostinglist_fakes.c:67: warning: control reaches end of non-void
  function [-Wreturn-type]
  dfmgr_test.c:68: warning: function 'errdetail_internal_impl' might be
  a candidate for 'gnu_printf' format attribute
  [-Wsuggest-attribute=format]

The pg_fprintf() fake is declared to return int and returned nothing; it returns 0 now. errdetail_internal_impl(), which stands in for errdetail() and errdetail_internal(), now carries their printf attribute, so its callers in dfmgr.c are format-checked as they are against the real functions, and it calls va_end(), which it never did.

make unittest-check compiles the tests with CFLAGS=-DUNITTEST alone, which is why it does not show these.

Assisted-by: Claude Code

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


Compiled with the server's warning flags, two unit test sources warn:

  ginpostinglist_fakes.c:67: warning: control reaches end of non-void
  function [-Wreturn-type]
  dfmgr_test.c:68: warning: function 'errdetail_internal_impl' might be
  a candidate for 'gnu_printf' format attribute
  [-Wsuggest-attribute=format]

The pg_fprintf() fake is declared to return int and returned nothing;
it returns 0 now. errdetail_internal_impl(), which stands in for
errdetail() and errdetail_internal(), now carries their printf
attribute, so its callers in dfmgr.c are format-checked as they are
against the real functions, and it calls va_end(), which it never did.

`make unittest-check` compiles the tests with CFLAGS=-DUNITTEST alone,
which is why it does not show these.

Assisted-by: Claude Code
@tuhaihe tuhaihe mentioned this pull request Oct 26, 2026
1 of 13 tasks
@tuhaihe tuhaihe added this to the 3.0 milestone Oct 26, 2026

@leborchuk leborchuk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, fix warning, it's just warnings, they mean nothing really important, mostly the results are ignored

@tuhaihe tuhaihe modified the milestones: 3.0, 3.x Meson Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants