diff --git a/doc/src/sgml/sslinfo.sgml b/doc/src/sgml/sslinfo.sgml
index 0fde0fc10e..78ff83d642 100644
--- a/doc/src/sgml/sslinfo.sgml
+++ b/doc/src/sgml/sslinfo.sgml
@@ -185,7 +185,7 @@ countryName (alias C)
 localityName (alias L)
 stateOrProvinceName (alias ST)
 organizationName (alias O)
-organizationUnitName (alias OU)
+organizationalUnitName (alias OU)
 title
 description
 initials
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 94309949fa..e33f019939 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -74,7 +74,7 @@ static HeapTuple heap_prepare_insert(Relation relation, HeapTuple tup,
 									 TransactionId xid, CommandId cid, int options);
 static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf,
 								  Buffer newbuf, HeapTuple oldtup,
-								  HeapTuple newtup, HeapTuple old_key_tup,
+								  HeapTuple newtup, HeapTuple old_key_tuple,
 								  bool all_visible_cleared, bool new_all_visible_cleared);
 static Bitmapset *HeapDetermineModifiedColumns(Relation relation,
 											   Bitmapset *interesting_cols,
diff --git a/src/backend/commands/define.c b/src/backend/commands/define.c
index b6c618aa00..9c93e415f1 100644
--- a/src/backend/commands/define.c
+++ b/src/backend/commands/define.c
@@ -139,7 +139,7 @@ defGetBoolean(DefElem *def)
 
 				/*
 				 * The set of strings accepted here should match up with the
-				 * grammar's opt_boolean production.
+				 * grammar's opt_boolean_or_string production.
 				 */
 				if (pg_strcasecmp(sval, "true") == 0)
 					return true;
diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c
index c12b613763..7e0a041fab 100644
--- a/src/backend/commands/prepare.c
+++ b/src/backend/commands/prepare.c
@@ -143,7 +143,7 @@ PrepareQuery(PrepareStmt *stmt, const char *queryString,
 	}
 
 	/*
-	 * grammar only allows OptimizableStmt, so this check should be redundant
+	 * grammar only allows PreparableStmt, so this check should be redundant
 	 */
 	switch (query->commandType)
 	{
diff --git a/src/backend/nodes/tidbitmap.c b/src/backend/nodes/tidbitmap.c
index bf53459996..23905a9c35 100644
--- a/src/backend/nodes/tidbitmap.c
+++ b/src/backend/nodes/tidbitmap.c
@@ -1021,7 +1021,7 @@ tbm_iterate(TBMIterator *iterator)
 		PagetableEntry *page;
 		int			ntuples;
 
-		/* In ONE_PAGE state, we don't allocate an spages[] array */
+		/* In TBM_ONE_PAGE state, we don't allocate an spages[] array */
 		if (tbm->status == TBM_ONE_PAGE)
 			page = &tbm->entry1;
 		else
diff --git a/src/backend/storage/ipc/shm_mq.c b/src/backend/storage/ipc/shm_mq.c
index 4c245d1f85..551515960d 100644
--- a/src/backend/storage/ipc/shm_mq.c
+++ b/src/backend/storage/ipc/shm_mq.c
@@ -1251,7 +1251,7 @@ shm_mq_inc_bytes_written(shm_mq *mq, Size n)
 						pg_atomic_read_u64(&mq->mq_bytes_written) + n);
 }
 
-/* Shim for on_dsm_callback. */
+/* Shim for on_dsm_detach callback. */
 static void
 shm_mq_detach_callback(dsm_segment *seg, Datum arg)
 {
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index f9b1ae6809..40a6b3745c 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -54,8 +54,6 @@
 
 static void usage(const char *progname);
 
-typedef struct option optType;
-
 int
 main(int argc, char **argv)
 {
diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h
index afb3e15721..9345052bff 100644
--- a/src/include/access/gin_private.h
+++ b/src/include/access/gin_private.h
@@ -54,7 +54,7 @@ typedef struct GinState
 	bool		oneCol;			/* true if single-column index */
 
 	/*
-	 * origTupDesc is the nominal tuple descriptor of the index, ie, the i'th
+	 * origTupdesc is the nominal tuple descriptor of the index, ie, the i'th
 	 * attribute shows the key type (not the input data type!) of the i'th
 	 * index column.  In a single-column index this describes the actual leaf
 	 * index tuples.  In a multi-column index, the actual leaf tuples contain
diff --git a/src/include/access/hash.h b/src/include/access/hash.h
index 107c3d01ae..f16eebeee2 100644
--- a/src/include/access/hash.h
+++ b/src/include/access/hash.h
@@ -252,8 +252,8 @@ typedef struct HashMetaPageData
 	uint32		hashm_maxbucket;	/* ID of maximum bucket in use */
 	uint32		hashm_highmask; /* mask to modulo into entire table */
 	uint32		hashm_lowmask;	/* mask to modulo into lower half of table */
-	uint32		hashm_ovflpoint;	/* splitpoint from which ovflpgs being
-									 * allocated */
+	uint32		hashm_ovflpoint;	/* splitpoint from which ovflpage
+								* being allocated */
 	uint32		hashm_firstfree;	/* lowest-number free ovflpage (bit#) */
 	uint32		hashm_nmaps;	/* number of bitmap pages */
 	RegProcedure hashm_procid;	/* hash function id from pg_proc */
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 4e2016c7ae..de5c43a460 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -2062,8 +2062,9 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator,
 	/*------
 	 * create a list of variables
 	 *
-	 * The variables are listed with input variables preceding outputvariables
-	 * The end of each group is marked by an end marker. per variable we list:
+	 * The variables are listed with input variables preceding output
+	 * variables.  The end of each group is marked by an end marker.
+	 * Per variable we list:
 	 *
 	 * type - as defined in ecpgtype.h
 	 * value - where to store the data
