diff --git a/contrib/test_decoding/test_decoding.c b/contrib/test_decoding/test_decoding.c
index a0ded67b9a..6c33c4bded 100644
--- a/contrib/test_decoding/test_decoding.c
+++ b/contrib/test_decoding/test_decoding.c
@@ -24,7 +24,7 @@
 
 PG_MODULE_MAGIC;
 
-/* These must be available to pg_dlsym() */
+/* These must be available to dlsym() */
 extern void _PG_init(void);
 extern void _PG_output_plugin_init(OutputPluginCallbacks *cb);
 
diff --git a/src/backend/access/hash/hashinsert.c b/src/backend/access/hash/hashinsert.c
index 5321762d5e..89876d2ccd 100644
--- a/src/backend/access/hash/hashinsert.c
+++ b/src/backend/access/hash/hashinsert.c
@@ -257,8 +257,8 @@ restart_insert:
  *	_hash_pgaddtup() -- add a tuple to a particular page in the index.
  *
  * This routine adds the tuple to the page as requested; it does not write out
- * the page.  It is an error to call pgaddtup() without pin and write lock on
- * the target buffer.
+ * the page.  It is an error to call this function without pin and write lock
+ * on the target buffer.
  *
  * Returns the offset number at which the tuple was inserted.  This function
  * is responsible for preserving the condition that tuples in a hash index
diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index def00cd7c5..ac441a19b8 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -93,7 +93,7 @@ typedef struct WindowStatePerFuncData
 	bool		resulttypeByVal;
 
 	bool		plain_agg;		/* is it just a plain aggregate function? */
-	int			aggno;			/* if so, index of its PerAggData */
+	int			aggno;		/* if so, index of its WindowStatePerAggData */
 
 	WindowObject winobj;		/* object used in window function API */
 }			WindowStatePerFuncData;
@@ -142,7 +142,7 @@ typedef struct WindowStatePerAggData
 				resulttypeByVal,
 				transtypeByVal;
 
-	int			wfuncno;		/* index of associated PerFuncData */
+	int			wfuncno;	/* index of associated WindowStatePerFuncData */
 
 	/* Context holding transition value and possibly other subsidiary data */
 	MemoryContext aggcontext;	/* may be private, or winstate->aggcontext */
diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c
index f526106530..5d4f26a490 100644
--- a/src/backend/utils/adt/genfile.c
+++ b/src/backend/utils/adt/genfile.c
@@ -325,7 +325,7 @@ pg_read_binary_file(PG_FUNCTION_ARGS)
 
 /*
  * Wrapper functions for the 1 and 3 argument variants of pg_read_file_v2()
- * and pg_binary_read_file().
+ * and pg_read_binary_file().
  *
  * These are necessary to pass the sanity check in opr_sanity, which checks
  * that all built-in functions that share the implementing C function take
diff --git a/src/backend/utils/mmgr/slab.c b/src/backend/utils/mmgr/slab.c
index e23669fb4f..bd8d200982 100644
--- a/src/backend/utils/mmgr/slab.c
+++ b/src/backend/utils/mmgr/slab.c
@@ -40,7 +40,7 @@
  *
  *	For each block, we maintain pointer to the first free chunk - this is quite
  *	cheap and allows us to skip all the preceding used chunks, eliminating
- *	a significant number of lookups in many common usage patters. In the worst
+ *	a significant number of lookups in many common usage patterns. In the worst
  *	case this performs as if the pointer was not maintained.
  *
  *	We cache the freelist index for the blocks with the fewest free chunks
diff --git a/src/include/access/commit_ts.h b/src/include/access/commit_ts.h
index e22bfbf3e6..1433aa3ff7 100644
--- a/src/include/access/commit_ts.h
+++ b/src/include/access/commit_ts.h
@@ -35,7 +35,7 @@ extern Size CommitTsShmemSize(void);
 extern void CommitTsShmemInit(void);
 extern void BootStrapCommitTs(void);
 extern void StartupCommitTs(void);
-extern void CommitTsParameterChange(bool xlrecvalue, bool pgcontrolvalue);
+extern void CommitTsParameterChange(bool newvalue, bool oldvalue);
 extern void CompleteCommitTsInitialization(void);
 extern void ShutdownCommitTs(void);
 extern void CheckPointCommitTs(void);
diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h
index 0339b98041..3e3e6c470e 100644
--- a/src/include/mb/pg_wchar.h
+++ b/src/include/mb/pg_wchar.h
@@ -289,7 +289,7 @@ typedef enum pg_enc
 #define PG_ENCODING_BE_LAST PG_KOI8U
 
 /*
- * Please use these tests before access to pg_encconv_tbl[]
+ * Please use these tests before access to pg_enc2name_tbl[]
  * or to other places...
  */
 #define PG_VALID_BE_ENCODING(_enc) \
diff --git a/src/include/port/atomics.h b/src/include/port/atomics.h
index f93009eff5..fab66f8e98 100644
--- a/src/include/port/atomics.h
+++ b/src/include/port/atomics.h
@@ -178,7 +178,7 @@ pg_atomic_init_flag(volatile pg_atomic_flag *ptr)
 }
 
 /*
- * pg_atomic_test_and_set_flag - TAS()
+ * pg_atomic_test_set_flag - TAS()
  *
  * Returns true if the flag has successfully been set, false otherwise.
  *
diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm
index 0d3554659b..7d16a36868 100644
--- a/src/tools/msvc/Project.pm
+++ b/src/tools/msvc/Project.pm
@@ -230,7 +230,7 @@ sub AddDir
 				if ($filter eq "LIBOBJS")
 				{
 					no warnings qw(once);
-					if (grep(/$p/, @main::pgportfiles, @main::pgcommonfiles)
+					if (grep(/$p/, @main::pgportfiles)
 						== 1)
 					{
 						$p =~ s/\.c/\.o/;
