fix -Wmissing-prototypes for neon extension (#7010)

## Problem

ref https://github.com/neondatabase/neon/issues/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.


e62baa9704/.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>
This commit is contained in:
Alex Chi Z
2024-03-05 10:03:44 -05:00
committed by GitHub
parent bdbb2f4afc
commit b036c32262
10 changed files with 33 additions and 13 deletions

View File

@@ -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;
@@ -113,6 +114,8 @@ ConstructDeltaMessage()
if (RootTable.db_table)
{
JsonbValue dbs;
HASH_SEQ_STATUS status;
DbEntry *entry;
dbs.type = jbvString;
dbs.val.string.val = "dbs";
@@ -120,9 +123,6 @@ ConstructDeltaMessage()
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)
{
@@ -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)
{
@@ -831,7 +832,7 @@ NeonProcessUtility(
}
}
extern void
void
InitControlPlaneConnector()
{
PreviousProcessUtilityHook = ProcessUtility_hook;

View File

@@ -1,6 +1,6 @@
#ifndef CONTROL_PLANE_CONNECTOR_H
#define CONTROL_PLANE_CONNECTOR_H
void InitControlPlaneConnector();
void InitControlPlaneConnector(void);
#endif

View File

@@ -14,6 +14,7 @@
#include "utils/guc.h"
#include "extension_server.h"
#include "neon_utils.h"
static int extension_server_port = 0;

View File

@@ -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 */

View File

@@ -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"

View File

@@ -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 */

View File

@@ -6,6 +6,7 @@
#include "postgres.h"
#include "neon_utils.h"
#include "lib/stringinfo.h"
#include "libpq/pqformat.h"
@@ -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')

View File

@@ -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

View File

@@ -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;
@@ -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)
{

View File

@@ -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);