diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c
index 2be0055c3f..4f49c5981a 100644
--- a/contrib/cube/cube.c
+++ b/contrib/cube/cube.c
@@ -590,7 +590,7 @@ g_cube_picksplit(PG_FUNCTION_ARGS)
 			v->spl_nright++;
 		}
 	}
-	*left = *right = FirstOffsetNumber; /* sentinel value, see dosplit() */
+	*left = *right = FirstOffsetNumber; /* sentinel value */
 
 	v->spl_ldatum = PointerGetDatum(datum_l);
 	v->spl_rdatum = PointerGetDatum(datum_r);
diff --git a/src/backend/lib/dshash.c b/src/backend/lib/dshash.c
index 24dd372252..350f8c0a66 100644
--- a/src/backend/lib/dshash.c
+++ b/src/backend/lib/dshash.c
@@ -409,7 +409,7 @@ dshash_find(dshash_table *hash_table, const void *key, bool exclusive)
 	}
 	else
 	{
-		/* The caller will free the lock by calling dshash_release. */
+		/* The caller will free the lock by calling dshash_release_lock. */
 		hash_table->find_locked = true;
 		hash_table->find_exclusively_locked = exclusive;
 		return ENTRY_FROM_ITEM(item);
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 7a1b38466b..57f17e1418 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -1074,7 +1074,7 @@ sendDir(const char *path, int basepathlen, bool sizeonly, List *tablespaces,
 		 * error in that case. The error handler further up will call
 		 * do_pg_abort_backup() for us. Also check that if the backup was
 		 * started while still in recovery, the server wasn't promoted.
-		 * dp_pg_stop_backup() will check that too, but it's better to stop
+		 * do_pg_stop_backup() will check that too, but it's better to stop
 		 * the backup early than continue to the end and fail there.
 		 */
 		CHECK_FOR_INTERRUPTS();
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index 391b6d6e16..f5f6a29222 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -361,7 +361,7 @@ DropRelFileNodeLocalBuffers(RelFileNode rnode, ForkNumber forkNum,
  *		This function removes from the buffer pool all pages of all forks
  *		of the specified relation.
  *
- *		See DropRelFileNodeAllBuffers in bufmgr.c for more notes.
+ *		See DropRelFileNodesAllBuffers in bufmgr.c for more notes.
  */
 void
 DropRelFileNodeAllLocalBuffers(RelFileNode rnode)
diff --git a/src/backend/utils/adt/tsrank.c b/src/backend/utils/adt/tsrank.c
index 55a9649879..e28859d8e1 100644
--- a/src/backend/utils/adt/tsrank.c
+++ b/src/backend/utils/adt/tsrank.c
@@ -738,7 +738,7 @@ get_docrep(TSVector txt, QueryRepresentation *qr, int *doclen)
 	doc = (DocRepresentation *) palloc(sizeof(DocRepresentation) * len);
 
 	/*
-	 * Iterate through query to make DocRepresentaion for words and it's
+	 * Iterate through query to make DocRepresentation for words and it's
 	 * entries satisfied by query
 	 */
 	for (i = 0; i < qr->query->size; i++)
diff --git a/src/include/port/atomics/generic-acc.h b/src/include/port/atomics/generic-acc.h
index eec5063cbc..a64c841f4f 100644
--- a/src/include/port/atomics/generic-acc.h
+++ b/src/include/port/atomics/generic-acc.h
@@ -68,7 +68,7 @@ pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
 	_Asm_mf();
 	/*
 	 * Notes:
-	 * DOWN_MEM_FENCE | _UP_MEM_FENCE prevents reordering by the compiler
+	 * _DOWN_MEM_FENCE | _UP_MEM_FENCE prevents reordering by the compiler
 	 */
 	current =  _Asm_cmpxchg(_SZ_W, /* word */
 							_SEM_REL,
diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h
index f4841fb397..da6b0c90a0 100644
--- a/src/include/port/win32_port.h
+++ b/src/include/port/win32_port.h
@@ -85,7 +85,6 @@
 #define IPC_NOWAIT	2048
 #define IPC_STAT 4096
 
-#define EACCESS 2048
 #ifndef EIDRM
 #define EIDRM 4096
 #endif
diff --git a/src/interfaces/ecpg/compatlib/exports.txt b/src/interfaces/ecpg/compatlib/exports.txt
index e0cfd7a22d..86e9ca1640 100644
--- a/src/interfaces/ecpg/compatlib/exports.txt
+++ b/src/interfaces/ecpg/compatlib/exports.txt
@@ -1,5 +1,5 @@
 # src/interfaces/ecpg/compatlib/exports.txt
-# Functions to be exported by ecpg_compatlib DLL
+# Functions to be exported by libecpg_compat DLL
 ECPG_informix_get_var   1
 ECPG_informix_set_var   2
 decadd                  3
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 3c0294e98a..4394b420a1 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -1899,7 +1899,7 @@ ecpg_process_output(struct statement *stmt, bool clear_result)
 
 			/*
 			 * execution should never reach this code because it is already
-			 * handled in ECPGcheck_PQresult()
+			 * handled in ecpg_check_PQresult()
 			 */
 			ecpg_log("ecpg_process_output on line %d: unknown execution status type\n",
 					 stmt->lineno);
diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h
index f1031d2595..e12d703b4e 100644
--- a/src/interfaces/ecpg/include/ecpglib.h
+++ b/src/interfaces/ecpg/include/ecpglib.h
@@ -63,8 +63,6 @@ char	   *ECPGprepared_statement(const char *, const char *, int);
 PGconn	   *ECPGget_PGconn(const char *);
 PGTransactionStatusType ECPGtransactionStatus(const char *);
 
-char	   *ECPGerrmsg(void);
-
  /* print an error message */
 void		sqlprint(void);
 
