Skip to content

Commit

Permalink
fix -Wmissing-prototypes for neon extension (#7010)
Browse files Browse the repository at this point in the history
## Problem

ref #6188

## Summary of changes

This pull request fixes `-Wmissing-prototypes` for the neon extension.
Note that (1) the gcc version in CI and macOS is different, therefore
some of the warning does not get reported when developing the neon
extension locally. (2) the CI env variable `COPT = -Werror` does not get
passed into the docker build process, therefore warnings are not treated
as errors on CI.


https://github.com/neondatabase/neon/blob/e62baa97041e10ce45772b3724e24e679a650d69/.github/workflows/build_and_test.yml#L22

There will be follow-up pull requests on solving other warnings. By the
way, I did not figure out the default compile parameters in the CI env,
and therefore this pull request is tested by manually adding
`-Wmissing-prototypes` into the `COPT`.

Signed-off-by: Alex Chi Z <chi@neon.tech>
  • Loading branch information
skyzh committed Mar 5, 2024
1 parent bdbb2f4 commit b036c32
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 13 deletions.
11 changes: 6 additions & 5 deletions pgxn/neon/control_plane_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "utils/memutils.h"
#include "utils/jsonb.h"

#include "control_plane_connector.h"
#include "neon_utils.h"

static ProcessUtility_hook_type PreviousProcessUtilityHook = NULL;
Expand Down Expand Up @@ -113,16 +114,15 @@ ConstructDeltaMessage()
if (RootTable.db_table)
{
JsonbValue dbs;
HASH_SEQ_STATUS status;
DbEntry *entry;

dbs.type = jbvString;
dbs.val.string.val = "dbs";
dbs.val.string.len = strlen(dbs.val.string.val);
pushJsonbValue(&state, WJB_KEY, &dbs);
pushJsonbValue(&state, WJB_BEGIN_ARRAY, NULL);

HASH_SEQ_STATUS status;
DbEntry *entry;

hash_seq_init(&status, RootTable.db_table);
while ((entry = hash_seq_search(&status)) != NULL)
{
Expand Down Expand Up @@ -168,8 +168,9 @@ ConstructDeltaMessage()
#else
const char *logdetail;
#endif
char *encrypted_password;
PushKeyValue(&state, "password", (char *) entry->password);
char *encrypted_password = get_role_password(entry->name, &logdetail);
encrypted_password = get_role_password(entry->name, &logdetail);

if (encrypted_password)
{
Expand Down Expand Up @@ -831,7 +832,7 @@ NeonProcessUtility(
}
}

extern void
void
InitControlPlaneConnector()
{
PreviousProcessUtilityHook = ProcessUtility_hook;
Expand Down
2 changes: 1 addition & 1 deletion pgxn/neon/control_plane_connector.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef CONTROL_PLANE_CONNECTOR_H
#define CONTROL_PLANE_CONNECTOR_H

void InitControlPlaneConnector();
void InitControlPlaneConnector(void);

#endif
1 change: 1 addition & 0 deletions pgxn/neon/extension_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "utils/guc.h"

#include "extension_server.h"
#include "neon_utils.h"

static int extension_server_port = 0;
Expand Down
17 changes: 17 additions & 0 deletions pgxn/neon/extension_server.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*-------------------------------------------------------------------------
*
* extension_server.h
* Request compute_ctl to download extension files.
*
* IDENTIFICATION
* contrib/neon/extension_server.h
*
*-------------------------------------------------------------------------
*/

#ifndef EXTENSION_SERVER_H
#define EXTENSION_SERVER_H

void pg_init_extension_server(void);

#endif /* EXTENSION_SERVER_H */
1 change: 1 addition & 0 deletions pgxn/neon/neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "utils/guc.h"
#include "utils/wait_event.h"

#include "extension_server.h"
#include "neon.h"
#include "walproposer.h"
#include "pagestore_client.h"
Expand Down
3 changes: 1 addition & 2 deletions pgxn/neon/neon.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ extern int wal_acceptor_connection_timeout;
extern void pg_init_libpagestore(void);
extern void pg_init_walproposer(void);

extern void pg_init_extension_server(void);

extern uint64 BackpressureThrottlingTime(void);
extern void replication_feedback_get_lsns(XLogRecPtr *writeLsn, XLogRecPtr *flushLsn, XLogRecPtr *applyLsn);

extern void PGDLLEXPORT WalProposerSync(int argc, char *argv[]);
extern void PGDLLEXPORT WalProposerMain(Datum main_arg);
PGDLLEXPORT void LogicalSlotsMonitorMain(Datum main_arg);

#endif /* NEON_H */
3 changes: 2 additions & 1 deletion pgxn/neon/neon_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "postgres.h"

#include "neon_utils.h"
#include "lib/stringinfo.h"
#include "libpq/pqformat.h"

Expand All @@ -14,7 +15,7 @@
*
* Returns -1 if the character is not a hexadecimal digit.
*/
int
static int
HexDecodeChar(char c)
{
if (c >= '0' && c <= '9')
Expand Down
2 changes: 1 addition & 1 deletion pgxn/neon/neon_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ uint32 pq_getmsgint32_le(StringInfo msg);
uint64 pq_getmsgint64_le(StringInfo msg);
void pq_sendint32_le(StringInfo buf, uint32 i);
void pq_sendint64_le(StringInfo buf, uint64 i);
extern void disable_core_dump();
void disable_core_dump(void);

#ifndef WALPROPOSER_LIB

Expand Down
4 changes: 2 additions & 2 deletions pgxn/neon/walproposer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ RecvAppendResponses(Safekeeper *sk)
}

/* Parse a PageserverFeedback message, or the PageserverFeedback part of an AppendResponse */
void
static void
ParsePageserverFeedbackMessage(WalProposer *wp, StringInfo reply_message, PageserverFeedback *rf)
{
uint8 nkeys;
Expand Down Expand Up @@ -1590,9 +1590,9 @@ GetAcknowledgedByQuorumWALPosition(WalProposer *wp)
Safekeeper *
GetDonor(WalProposer *wp, XLogRecPtr *donor_lsn)
{
*donor_lsn = InvalidXLogRecPtr;
Safekeeper *donor = NULL;
int i;
*donor_lsn = InvalidXLogRecPtr;

if (wp->n_votes < wp->quorum)
{
Expand Down
2 changes: 1 addition & 1 deletion pgxn/neon/walproposer_pg.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ walprop_pg_get_shmem_state(WalProposer *wp)
return walprop_shared;
}

void
static void
replication_feedback_set(PageserverFeedback *rf)
{
SpinLockAcquire(&walprop_shared->mutex);
Expand Down

1 comment on commit b036c32

@github-actions
Copy link

Choose a reason for hiding this comment

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

2567 tests run: 2433 passed, 0 failed, 134 skipped (full report)


Code coverage* (full report)

  • functions: 28.8% (6983 of 24243 functions)
  • lines: 47.4% (42877 of 90525 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
b036c32 at 2024-03-05T16:20:06.174Z :recycle:

Please sign in to comment.