Skip to content

Fix two compiler warnings in backend unit tests - #2191

Merged
tuhaihe merged 1 commit into
apache:mainfrom
tuhaihe:fix-unittest-warnings
Nov 21, 2026
Merged

tuhaihe merged 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


@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
@tuhaihe
tuhaihe force-pushed the fix-unittest-warnings branch from 1158f19 to 11562a6 Compare November 15, 2026 13:55
@tuhaihe

tuhaihe commented Nov 15, 2026

Copy link
Copy Markdown
Member Author

There is some code repeating. Need to take a look again.

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 force-pushed the fix-unittest-warnings branch from 11562a6 to e944948 Compare November 21, 2026 07:25
@tuhaihe
tuhaihe enabled auto-merge (rebase) November 21, 2026 08:12
@tuhaihe
tuhaihe merged commit d44a788 into apache:main Nov 21, 2026
135 checks passed
@tuhaihe
tuhaihe deleted the fix-unittest-warnings branch November 21, 2026 09:00
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