14422 gcc10 build does not remove unused static functions
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Rich Lowe <richlowe@richlowe.net>
diff --git a/usr/src/common/mc/mc-amd/mcamd_patounum.c b/usr/src/common/mc/mc-amd/mcamd_patounum.c
index 52ecce0..9811aae 100644
--- a/usr/src/common/mc/mc-amd/mcamd_patounum.c
+++ b/usr/src/common/mc/mc-amd/mcamd_patounum.c
@@ -22,8 +22,6 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * Given a physical address and an optional syndrome, determine the
  * name of the memory module that contains it.
@@ -435,6 +433,7 @@
 	}
 }
 
+#ifdef DEBUG
 /*
  * Brute-force BKDG pa to cs translation, coded to look as much like the
  * BKDG code as possible.
@@ -599,6 +598,7 @@
 
 	return (mcamd_set_errno(hdl, EMCAMD_NOADDR));
 }
+#endif /* DEBUG */
 
 /*
  * Called for each memory controller to see if the given address is
diff --git a/usr/src/uts/common/io/axf/axf_usbgem.c b/usr/src/uts/common/io/axf/axf_usbgem.c
index 2b1bc4f..555aecd 100644
--- a/usr/src/uts/common/io/axf/axf_usbgem.c
+++ b/usr/src/uts/common/io/axf/axf_usbgem.c
@@ -791,6 +791,7 @@
 	return (new);
 }
 
+#if DEBUG_LEVEL > 10
 static void
 axf_dump_packet(struct usbgem_dev *dp, uint8_t *bp, int n)
 {
@@ -801,6 +802,7 @@
 		    bp[0], bp[1], bp[2], bp[3], bp[4], bp[5], bp[6], bp[7]);
 	}
 }
+#endif
 
 static mblk_t *
 axf_rx_make_packet(struct usbgem_dev *dp, mblk_t *mp)
diff --git a/usr/src/uts/common/io/iwk/iwk2.c b/usr/src/uts/common/io/iwk/iwk2.c
index 6b5c643..b0025ad 100644
--- a/usr/src/uts/common/io/iwk/iwk2.c
+++ b/usr/src/uts/common/io/iwk/iwk2.c
@@ -335,7 +335,7 @@
 static int	iwk_m_unicst(void *arg, const uint8_t *macaddr);
 static int	iwk_m_multicst(void *arg, boolean_t add, const uint8_t *m);
 static int	iwk_m_promisc(void *arg, boolean_t on);
-static mblk_t 	*iwk_m_tx(void *arg, mblk_t *mp);
+static mblk_t	*iwk_m_tx(void *arg, mblk_t *mp);
 static void	iwk_m_ioctl(void *arg, queue_t *wq, mblk_t *mp);
 static int	iwk_m_setprop(void *arg, const char *pr_name,
 	mac_prop_id_t wldp_pr_name, uint_t wldp_length, const void *wldp_buf);
@@ -5919,6 +5919,7 @@
 	mutex_exit(&sc->sc_glock);
 }
 
+#ifdef DEBUG
 /*
  * 1)  log_event_table_ptr indicates base of the event log.  This traces
  *     a 256-entry history of uCode execution within a circular buffer.
@@ -6103,6 +6104,7 @@
 
 	iwk_mac_access_exit(sc);
 }
+#endif /* DEBUG */
 
 static int
 iwk_run_state_config_ibss(ieee80211com_t *ic)
diff --git a/usr/src/uts/common/io/mem.c b/usr/src/uts/common/io/mem.c
index 96262bf..cde4fab 100644
--- a/usr/src/uts/common/io/mem.c
+++ b/usr/src/uts/common/io/mem.c
@@ -99,8 +99,6 @@
 static int mm_kstat_update(kstat_t *ksp, int rw);
 static int mm_kstat_snapshot(kstat_t *ksp, void *buf, int rw);
 
-static int mm_read_mem_name(intptr_t data, mem_name_t *mem_name);
-
 #define	MM_KMEMLOG_NENTRIES	64
 
 static int mm_kmemlogent;
@@ -335,6 +333,8 @@
 	return (error);
 }
 
+#ifdef	__sparc
+
 static int
 mmpagelock(struct as *as, caddr_t va)
 {
@@ -349,8 +349,6 @@
 	return (i);
 }
 
-#ifdef	__sparc
-
 #define	NEED_LOCK_KVADDR(kva)	mmpagelock(&kas, kva)
 
 #else
@@ -642,6 +640,37 @@
 
 #ifdef __sparc
 /*
+ * Read a mem_name_t from user-space and store it in the mem_name_t
+ * pointed to by the mem_name argument.
+ */
+static int
+mm_read_mem_name(intptr_t data, mem_name_t *mem_name)
+{
+	if (get_udatamodel() == DATAMODEL_NATIVE) {
+		if (copyin((void *)data, mem_name, sizeof (mem_name_t)))
+			return (EFAULT);
+	}
+#ifdef	_SYSCALL32
+	else {
+		mem_name32_t mem_name32;
+
+		if (copyin((void *)data, &mem_name32, sizeof (mem_name32_t)))
+			return (EFAULT);
+		mem_name->m_addr = mem_name32.m_addr;
+		mem_name->m_synd = mem_name32.m_synd;
+		mem_name->m_type[0] = mem_name32.m_type[0];
+		mem_name->m_type[1] = mem_name32.m_type[1];
+		mem_name->m_name = (caddr_t)(uintptr_t)mem_name32.m_name;
+		mem_name->m_namelen = (size_t)mem_name32.m_namelen;
+		mem_name->m_sid = (caddr_t)(uintptr_t)mem_name32.m_sid;
+		mem_name->m_sidlen = (size_t)mem_name32.m_sidlen;
+	}
+#endif	/* _SYSCALL32 */
+
+	return (0);
+}
+
+/*
  * Given a syndrome, syndrome type, and address return the
  * associated memory name in the provided data buffer.
  */
@@ -1086,34 +1115,3 @@
 
 	return (0);
 }
-
-/*
- * Read a mem_name_t from user-space and store it in the mem_name_t
- * pointed to by the mem_name argument.
- */
-static int
-mm_read_mem_name(intptr_t data, mem_name_t *mem_name)
-{
-	if (get_udatamodel() == DATAMODEL_NATIVE) {
-		if (copyin((void *)data, mem_name, sizeof (mem_name_t)))
-			return (EFAULT);
-	}
-#ifdef	_SYSCALL32
-	else {
-		mem_name32_t mem_name32;
-
-		if (copyin((void *)data, &mem_name32, sizeof (mem_name32_t)))
-			return (EFAULT);
-		mem_name->m_addr = mem_name32.m_addr;
-		mem_name->m_synd = mem_name32.m_synd;
-		mem_name->m_type[0] = mem_name32.m_type[0];
-		mem_name->m_type[1] = mem_name32.m_type[1];
-		mem_name->m_name = (caddr_t)(uintptr_t)mem_name32.m_name;
-		mem_name->m_namelen = (size_t)mem_name32.m_namelen;
-		mem_name->m_sid = (caddr_t)(uintptr_t)mem_name32.m_sid;
-		mem_name->m_sidlen = (size_t)mem_name32.m_sidlen;
-	}
-#endif	/* _SYSCALL32 */
-
-	return (0);
-}
diff --git a/usr/src/uts/common/io/mwl/mwl.c b/usr/src/uts/common/io/mwl/mwl.c
index 114b32e..6b23d49 100644
--- a/usr/src/uts/common/io/mwl/mwl.c
+++ b/usr/src/uts/common/io/mwl/mwl.c
@@ -1196,6 +1196,7 @@
 #undef MAX_WAIT_FW_COMPLETE_ITERATIONS
 }
 
+#ifdef DEBUG
 static const char *
 mwlcmdname(int cmd)
 {
@@ -1255,6 +1256,7 @@
 	return (buf);
 #undef CMD
 }
+#endif /* DEBUG */
 
 static void
 dumpresult(struct mwl_softc *sc, int showresult)
diff --git a/usr/src/uts/common/io/nge/nge_chip.c b/usr/src/uts/common/io/nge/nge_chip.c
index 0bef9ff..b10346e 100644
--- a/usr/src/uts/common/io/nge/nge_chip.c
+++ b/usr/src/uts/common/io/nge/nge_chip.c
@@ -107,7 +107,7 @@
 
 }
 
-
+#if	NGE_DEBUGGING
 static int nge_chip_peek_cfg(nge_t *ngep, nge_peekpoke_t *ppd);
 #pragma	no_inline(nge_chip_peek_cfg)
 
@@ -426,6 +426,7 @@
 	    ppd->pp_acc_offset, &data);
 	return (err);
 }
+#endif /* NGE_DEBUGGING */
 
 void
 nge_init_dev_spec_param(nge_t *ngep)
@@ -1846,6 +1847,7 @@
 	return (DDI_INTR_CLAIMED);
 }
 
+#if	NGE_DEBUGGING
 static enum ioc_reply
 nge_pp_ioctl(nge_t *ngep, int cmd, mblk_t *mp, struct iocblk *iocp)
 {
@@ -1985,6 +1987,7 @@
 
 	/* NOTREACHED */
 }
+#endif /* NGE_DEBUGGING */
 
 enum ioc_reply
 nge_chip_ioctl(nge_t *ngep, mblk_t *mp, struct iocblk *iocp)
diff --git a/usr/src/uts/common/io/pcic.c b/usr/src/uts/common/io/pcic.c
index ef9ad90..e3764bc 100644
--- a/usr/src/uts/common/io/pcic.c
+++ b/usr/src/uts/common/io/pcic.c
@@ -6333,6 +6333,7 @@
 	mutex_exit(&pcic->pc_lock);
 }
 
+#if defined(__sparc)
 static int
 log_pci_cfg_err(ushort_t e, int bridge_secondary)
 {
@@ -6363,7 +6364,6 @@
 	return (nerr);
 }
 
-#if defined(__sparc)
 static int
 pcic_fault(enum pci_fault_ops op, void *arg)
 {
@@ -6786,6 +6786,7 @@
 
 static int	pcic_do_pprintf = 0;
 
+#ifdef PCIC_DEBUG
 static void
 pcic_dump_debqueue(char *msg)
 {
@@ -6802,6 +6803,7 @@
 		debp = debp->next;
 	}
 }
+#endif /* PCIC_DEBUG */
 
 
 /* PRINTFLIKE3 */
diff --git a/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c b/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c
index a3b22a9..eac5dac 100644
--- a/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c
+++ b/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c
@@ -2668,7 +2668,7 @@
 
 	return (NULL);
 }
-#endif
+#endif /* DEBUG */
 
 /*
  * We may (or may not) report observations to SCSA.  This is prefaced by
diff --git a/usr/src/uts/common/vm/seg_kmem.c b/usr/src/uts/common/vm/seg_kmem.c
index 0bab4eb..098b960 100644
--- a/usr/src/uts/common/vm/seg_kmem.c
+++ b/usr/src/uts/common/vm/seg_kmem.c
@@ -145,16 +145,19 @@
  */
 
 size_t	segkmem_lpsize;
-static  uint_t	segkmem_lpshift = PAGESHIFT;
 int	segkmem_lpszc = 0;
 
 size_t  segkmem_kmemlp_quantum = 0x400000;	/* 4MB */
 size_t  segkmem_heaplp_quantum;
 vmem_t *heap_lp_arena;
 static  vmem_t *kmem_lp_arena;
-static  vmem_t *segkmem_ppa_arena;
 static	segkmem_lpcb_t segkmem_lpcb;
 
+#ifdef __sparc
+static  uint_t	segkmem_lpshift = PAGESHIFT;
+static  vmem_t *segkmem_ppa_arena;
+#endif
+
 /*
  * We use "segkmem_kmemlp_max" to limit the total amount of physical memory
  * consumed by the large page heap. By default this parameter is set to 1/8 of
@@ -1097,6 +1100,7 @@
 	kmem_free(addr, ptob(npages));
 }
 
+#ifdef __sparc
 /*
  * segkmem_page_create_large() allocates a large page to be used for the kmem
  * caches. If kpr is enabled we ask for a relocatable page unless requested
@@ -1243,6 +1247,7 @@
 
 	/* page_unresv() is done by the caller */
 }
+#endif /* __sparc */
 
 /*
  * This function is called to import new spans into the vmem arenas like
@@ -1387,6 +1392,7 @@
 	}
 }
 
+#ifdef __sparc
 /*
  * segkmem_alloc_lpi() imports virtual memory from large page heap arena
  * into kmem_lp arena. In the process it maps the imported segment with
@@ -1439,6 +1445,7 @@
 
 	vmem_free(vmp, inaddr, size);
 }
+#endif /* __sparc */
 
 /*
  * This function is called at system boot time by kmem_init right after
diff --git a/usr/src/uts/i86pc/os/trap.c b/usr/src/uts/i86pc/os/trap.c
index 6c85fcb..7355e41 100644
--- a/usr/src/uts/i86pc/os/trap.c
+++ b/usr/src/uts/i86pc/os/trap.c
@@ -283,6 +283,7 @@
 	return (0);
 }
 
+#ifdef DEBUG
 static const char *
 syscall_insn_string(int syscall_insn)
 {
@@ -297,6 +298,7 @@
 		return ("Unknown");
 	}
 }
+#endif /* DEBUG */
 
 static int
 ldt_rewrite_syscall(struct regs *rp, proc_t *p, int syscall_insn)
diff --git a/usr/src/uts/intel/io/hotplug/pcicfg/pcicfg.c b/usr/src/uts/intel/io/hotplug/pcicfg/pcicfg.c
index 3f890d8..468da22 100644
--- a/usr/src/uts/intel/io/hotplug/pcicfg/pcicfg.c
+++ b/usr/src/uts/intel/io/hotplug/pcicfg/pcicfg.c
@@ -2448,6 +2448,7 @@
 		    length, ddi_get_name(entry->dip));
 }
 
+#ifdef __sparc
 static int
 pcicfg_sum_resources(dev_info_t *dip, void *hdl)
 {
@@ -2580,6 +2581,7 @@
 		return (DDI_WALK_CONTINUE);
 	}
 }
+#endif /* __sparc */
 
 static int
 pcicfg_free_bridge_resources(dev_info_t *dip)