Re: static inline, not inline static

2022-08-29 Thread Anders Andersson
On Mon, Aug 29, 2022 at 2:01 AM Philip Guenther  wrote:
>
> On Sun, Aug 28, 2022 at 2:11 PM Anders Andersson  wrote:
>>
>> On Sun, Aug 28, 2022 at 3:15 PM Jonathan Gray  wrote:
>> >
>> > diff --git lib/libc/locale/wctoint.h lib/libc/locale/wctoint.h
>> > index ea50c5ae1b6..14c7f0c466d 100644
>> > --- lib/libc/locale/wctoint.h
>> > +++ lib/libc/locale/wctoint.h
>> > @@ -30,7 +30,7 @@
>> >   */
>> >
>> >
>> > -inline static int
>> > +static inline int
>> >  wctoint(wchar_t wc)
>> >  {
>> > int n;
>> > [...]
>>
>> Why this change? As far as I can see, the standard allows for any order.
>
>
> C99 standard stated:
> "The placement of a storage-class specifier other than at the beginning of 
> the declaration
>  specifiers in a declaration is an obsolescent feature.
>
> My recall is that it was officially removed in C11.
>
> ok guenther@

This intrigued me so I had to do some archaeology. The grammar allows
any random order from K first edition up to (and including) this
month's C23 draft, but the warning has been in there since the first
ANSI C standard (and is still in C23).

Maybe someone forgot to push for this, and no one dares to remove the warning.



Re: static inline, not inline static

2022-08-28 Thread Philip Guenther
On Sun, Aug 28, 2022 at 2:11 PM Anders Andersson  wrote:

> On Sun, Aug 28, 2022 at 3:15 PM Jonathan Gray  wrote:
> >
> > diff --git lib/libc/locale/wctoint.h lib/libc/locale/wctoint.h
> > index ea50c5ae1b6..14c7f0c466d 100644
> > --- lib/libc/locale/wctoint.h
> > +++ lib/libc/locale/wctoint.h
> > @@ -30,7 +30,7 @@
> >   */
> >
> >
> > -inline static int
> > +static inline int
> >  wctoint(wchar_t wc)
> >  {
> > int n;
> > [...]
>
> Why this change? As far as I can see, the standard allows for any order.
>

C99 standard stated:
"The placement of a storage-class specifier other than at the beginning
of the declaration
 specifiers in a declaration is an obsolescent feature.

My recall is that it was officially removed in C11.

ok guenther@


Re: static inline, not inline static

2022-08-28 Thread Anders Andersson
On Sun, Aug 28, 2022 at 3:15 PM Jonathan Gray  wrote:
>
> diff --git lib/libc/locale/wctoint.h lib/libc/locale/wctoint.h
> index ea50c5ae1b6..14c7f0c466d 100644
> --- lib/libc/locale/wctoint.h
> +++ lib/libc/locale/wctoint.h
> @@ -30,7 +30,7 @@
>   */
>
>
> -inline static int
> +static inline int
>  wctoint(wchar_t wc)
>  {
> int n;
> [...]

Why this change? As far as I can see, the standard allows for any order.



static inline, not inline static

2022-08-28 Thread Jonathan Gray
diff --git lib/libc/locale/wctoint.h lib/libc/locale/wctoint.h
index ea50c5ae1b6..14c7f0c466d 100644
--- lib/libc/locale/wctoint.h
+++ lib/libc/locale/wctoint.h
@@ -30,7 +30,7 @@
  */
 
 
-inline static int
+static inline int
 wctoint(wchar_t wc)
 {
int n;
diff --git sys/arch/amd64/include/pmap.h sys/arch/amd64/include/pmap.h
index 04d3a3f3bde..87145870e56 100644
--- sys/arch/amd64/include/pmap.h
+++ sys/arch/amd64/include/pmap.h
@@ -434,7 +434,7 @@ pmap_remove_all(struct pmap *pmap)
  * if hardware doesn't support one-page flushing)
  */
 
-inline static void
+static inline void
 pmap_update_pg(vaddr_t va)
 {
invlpg(va);
@@ -449,7 +449,7 @@ pmap_update_pg(vaddr_t va)
  * unprotecting a page is done on-demand at fault time.
  */
 
-inline static void
+static inline void
 pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
 {
if ((prot & PROT_WRITE) == 0) {
@@ -469,7 +469,7 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
  * unprotecting a page is done on-demand at fault time.
  */
 
-inline static void
+static inline void
 pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
 {
if ((prot & PROT_WRITE) == 0) {
diff --git sys/arch/i386/include/cpu.h sys/arch/i386/include/cpu.h
index d9a965dbdd0..4fd4bbee57b 100644
--- sys/arch/i386/include/cpu.h
+++ sys/arch/i386/include/cpu.h
@@ -217,7 +217,7 @@ extern struct cpu_info *cpu_info_list;
 
 static struct cpu_info *curcpu(void);
 
-__inline static struct cpu_info *
+static __inline struct cpu_info *
 curcpu(void)
 {
struct cpu_info *ci;
diff --git sys/arch/i386/include/pmap.h sys/arch/i386/include/pmap.h
index c79a2849223..0ece59819ea 100644
--- sys/arch/i386/include/pmap.h
+++ sys/arch/i386/include/pmap.h
@@ -392,7 +392,7 @@ void pmap_flush_page_pae(paddr_t);
  * Unprotecting a page is done on-demand at fault time.
  */
 
-__inline static void
+static __inline void
 pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
 {
if ((prot & PROT_WRITE) == 0) {
@@ -412,7 +412,7 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
  * Unprotecting a page is done on-demand at fault time.
  */
 
-__inline static void
+static __inline void
 pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
 {
if ((prot & PROT_WRITE) == 0) {
@@ -429,25 +429,25 @@ pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, 
vm_prot_t prot)
  * modules from both uvm_pmap.h and pmap.h. Since uvm_pmap.h defines these
  * as functions, inline them here to suppress linker warnings.
  */
-__inline static vaddr_t
+static __inline vaddr_t
 pmap_growkernel(vaddr_t maxkvaddr)
 {
return (*pmap_growkernel_p)(maxkvaddr);
 }
 
-__inline static int
+static __inline int
 pmap_enter(struct pmap *pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int 
flags)
 {
return (*pmap_enter_p)(pmap, va, pa, prot, flags);
 }
 
-__inline static void
+static __inline void
 pmap_enter_special(vaddr_t va, paddr_t pa, vm_prot_t prot, u_int32_t flags)
 {
(*pmap_enter_special_p)(va, pa, prot, flags);
 }
 
-__inline static int
+static __inline int
 pmap_extract(struct pmap *pmap, vaddr_t va, paddr_t *pa)
 {
return (*pmap_extract_p)(pmap, va, pa);
diff --git sys/arch/luna88k/dev/mb89352.c sys/arch/luna88k/dev/mb89352.c
index 5e2f07fedd0..b2e20bfa3e2 100644
--- sys/arch/luna88k/dev/mb89352.c
+++ sys/arch/luna88k/dev/mb89352.c
@@ -5,7 +5,7 @@
 #ifdef DDB
 #defineintegrate
 #else
-#defineintegrate   __inline static
+#defineintegrate   static __inline 
 #endif
 
 /*-
diff --git sys/uvm/uvm_aobj.c sys/uvm/uvm_aobj.c
index 5e7098adbb2..6b9b269a9e6 100644
--- sys/uvm/uvm_aobj.c
+++ sys/uvm/uvm_aobj.c
@@ -241,7 +241,7 @@ uao_find_swhash_elt(struct uvm_aobj *aobj, int pageidx, 
boolean_t create)
 /*
  * uao_find_swslot: find the swap slot number for an aobj/pageidx
  */
-inline static int
+static inline int
 uao_find_swslot(struct uvm_object *uobj, int pageidx)
 {
struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
diff --git sys/uvm/uvm_page.c sys/uvm/uvm_page.c
index 4af64e2d4ca..abc7c01517a 100644
--- sys/uvm/uvm_page.c
+++ sys/uvm/uvm_page.c
@@ -130,7 +130,7 @@ int uvm_page_owner_locked_p(struct vm_page *);
  * => call should have already set pg's object and offset pointers
  *and bumped the version counter
  */
-inline static void
+static inline void
 uvm_pageinsert(struct vm_page *pg)
 {
struct vm_page  *dupe;
diff --git usr.sbin/npppd/npppd/npppd_pool.c usr.sbin/npppd/npppd/npppd_pool.c
index 8ae54b77695..09f31d68574 100644
--- usr.sbin/npppd/npppd/npppd_pool.c
+++ usr.sbin/npppd/npppd/npppd_pool.c
@@ -338,7 +338,7 @@ npppd_pool_get_dynamic(npppd_pool *_this, npppd_ppp *ppp)
return (uint32_t)0;
 }
 
-inline static int
+static inline int
 npppd_is_ifcace_ip4addr(npppd *_this, uint32_t ip4addr)
 {
int i;