> Date: Sat, 10 Sep 2016 11:59:29 -0700
> From: Philip Guenther <[email protected]>
> 
> The functions here all have full prototypes in scope, so gcc is already 
> treating them as if they were standard-style definitions.  While here, 
> s/__inline/inline/ as it's been 17 years since C99.
> 
> ok?

ok kettenis@

> A warning for those doing these sorts of K&R -> standard conversions: 
> beware of argument order mismatches in the K&R bits!  The order in the 
> parenthesised list is what matters and must be preserved, not the order of 
> the K&R declarations.  Here in trap.c the main trap example was this:
> 
> void
> data_access_error(tf, type, afva, afsr, sfva, sfsr)
>         struct trapframe64 *tf;
>         unsigned type;
>         vaddr_t sfva;
>         u_long sfsr;
>         vaddr_t afva;
>         u_long afsr;
> 
> The last four declaration must be shuffled when converting:
> 
> void
> data_access_error(struct trapframe64 *tf, unsigned type, vaddr_t afva,
>     u_long afsr, vaddr_t sfva, u_long sfsr)
> 
> 
> Philip Guenther
> 
> Index: trap.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/sparc64/sparc64/trap.c,v
> retrieving revision 1.90
> diff -u -p -r1.90 trap.c
> --- trap.c    10 Sep 2016 18:31:15 -0000      1.90
> +++ trap.c    10 Sep 2016 18:54:08 -0000
> @@ -309,7 +309,7 @@ const char *trap_type[] = {
>  
>  #define      N_TRAP_TYPES    (sizeof trap_type / sizeof *trap_type)
>  
> -static __inline void share_fpu(struct proc *, struct trapframe64 *);
> +static inline void share_fpu(struct proc *, struct trapframe64 *);
>  
>  void trap(struct trapframe64 *tf, unsigned type, vaddr_t pc, long tstate);
>  void data_access_fault(struct trapframe64 *tf, unsigned type, vaddr_t pc, 
> @@ -330,9 +330,8 @@ void syscall(struct trapframe64 *, regis
>   *
>   * Oh, and don't touch the FPU bit if we're returning to the kernel.
>   */
> -static __inline void share_fpu(p, tf)
> -     struct proc *p;
> -     struct trapframe64 *tf;
> +static inline void
> +share_fpu(struct proc *p, struct trapframe64 *tf)
>  {
>       if (!(tf->tf_tstate & TSTATE_PRIV) &&
>           (tf->tf_tstate & TSTATE_PEF) && fpproc != p)
> @@ -344,11 +343,7 @@ static __inline void share_fpu(p, tf)
>   * (MMU-related traps go through mem_access_fault, below.)
>   */
>  void
> -trap(tf, type, pc, tstate)
> -     struct trapframe64 *tf;
> -     unsigned type;
> -     vaddr_t pc;
> -     long tstate;
> +trap(struct trapframe64 *tf, unsigned type, vaddr_t pc, long tstate)
>  {
>       struct proc *p;
>       struct pcb *pcb;
> @@ -746,8 +741,7 @@ rwindow_save(struct proc *p)
>   * the registers into the new process after the exec.
>   */
>  void
> -pmap_unuse_final(p)
> -     struct proc *p;
> +pmap_unuse_final(struct proc *p)
>  {
>  
>       write_user_windows();
> @@ -759,13 +753,8 @@ pmap_unuse_final(p)
>   * of them could be recoverable through uvm_fault.
>   */
>  void
> -data_access_fault(tf, type, pc, addr, sfva, sfsr)
> -     struct trapframe64 *tf;
> -     unsigned type;
> -     vaddr_t pc;
> -     vaddr_t addr;
> -     vaddr_t sfva;
> -     u_long sfsr;
> +data_access_fault(struct trapframe64 *tf, unsigned type, vaddr_t pc,
> +    vaddr_t addr, vaddr_t sfva, u_long sfsr)
>  {
>       u_int64_t tstate;
>       struct proc *p;
> @@ -907,13 +896,8 @@ kfault:
>   * special PEEK/POKE code sequence.
>   */
>  void
> -data_access_error(tf, type, afva, afsr, sfva, sfsr)
> -     struct trapframe64 *tf;
> -     unsigned type;
> -     vaddr_t sfva;
> -     u_long sfsr;
> -     vaddr_t afva;
> -     u_long afsr;
> +data_access_error(struct trapframe64 *tf, unsigned type, vaddr_t afva,
> +    u_long afsr, vaddr_t sfva, u_long sfsr)
>  {
>       u_long pc;
>       u_int64_t tstate;
> @@ -989,11 +973,8 @@ out:
>   * of them could be recoverable through uvm_fault.
>   */
>  void
> -text_access_fault(tf, type, pc, sfsr)
> -     unsigned type;
> -     vaddr_t pc;
> -     struct trapframe64 *tf;
> -     u_long sfsr;
> +text_access_fault(struct trapframe64 *tf, unsigned type, vaddr_t pc,
> +    u_long sfsr)
>  {
>       u_int64_t tstate;
>       struct proc *p;
> @@ -1076,13 +1057,8 @@ text_access_fault(tf, type, pc, sfsr)
>   * special PEEK/POKE code sequence.
>   */
>  void
> -text_access_error(tf, type, pc, sfsr, afva, afsr)
> -     struct trapframe64 *tf;
> -     unsigned type;
> -     vaddr_t pc;
> -     u_long sfsr;
> -     vaddr_t afva;
> -     u_long afsr;
> +text_access_error(struct trapframe64 *tf, unsigned type, vaddr_t pc,
> +    u_long sfsr, vaddr_t afva, u_long afsr)
>  {
>       int64_t tstate;
>       struct proc *p;
> @@ -1188,10 +1164,7 @@ out:
>   * thing that made the system call, and are named that way here.
>   */
>  void
> -syscall(tf, code, pc)
> -     register_t code;
> -     struct trapframe64 *tf;
> -     register_t pc;
> +syscall(struct trapframe64 *tf, register_t code, register_t pc)
>  {
>       int i, nsys, nap;
>       int64_t *ap;
> 
> 

Reply via email to