poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add syntax rule sc_rockdabootism_missing_space.


From: Tim Rühsen
Subject: [PATCH] Add syntax rule sc_rockdabootism_missing_space.
Date: Fri, 15 May 2020 17:33:21 +0200

2020-05-15  Tim Rühsen  <address@hidden>

        * cfg.mk: New syntax rule sc_rockdabootism_missing_space.
        * common/pk-utils.c (pk_print_binary): Add missing space before
        opening bracket.
        * common/pk-utils.h (pk_str_concat): Likewise.
        * libpoke/ios.c (ios_read_int_common): Likewise.
        (ios_read_int). Likewise.
        * libpoke/pvm-val.c (pvm_print_val_1): Likewise.
        * poke/pk-cmd-set.c (pk_cmd_set_odepth): Likewise.
        (pk_cmd_set_oindent): Likewise.
        (pk_cmd_set_omode): Likewise.
        * poke/pk-hserver.c (pk_hserver_make_hyperlink): Likewise.
        * poke/pk-mi.c (pk_mi_fd_set_nonblocking): Likewise.
        (pk_mi_fd_restore_blocking): Likewise.
        * poke/pk-repl.c (poke_sigint_handler): Likewise.
        (pk_repl): Likewise.
        * poke/poke.c: Slightly amend comment.
---
 ChangeLog         | 19 +++++++++++++++++++
 cfg.mk            |  7 +++++++
 common/pk-utils.c |  4 ++--
 common/pk-utils.h |  2 +-
 libpoke/ios.c     |  6 +++---
 libpoke/pvm-val.c |  2 +-
 poke/pk-cmd-set.c |  6 +++---
 poke/pk-hserver.c | 14 +++++++-------
 poke/pk-mi.c      |  6 +++---
 poke/pk-repl.c    |  6 +++---
 poke/poke.c       |  2 +-
 11 files changed, 50 insertions(+), 24 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index dbb5365c..e6780b9a 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -19,4 +19,11 @@ sc_jemarchism_file_fd:
        halt='do not use FILE *fd, use FILE *fp instead' \
          $(_sc_search_regexp)

+sc_rockdabootism_missing_space:
+       @prohibit='[a-z]+\('                    \
+       in_vc_files='\.[ch]$$'                  \
+       exclude="([a-z]+\(3\)\.|poke\(wo\)men)" \
+       halt='missing space before ('           \
+       $(_sc_search_regexp)
+
 local-checks-available=sc_jemarchism
diff --git a/common/pk-utils.c b/common/pk-utils.c
index 157d93a2..475a1e43 100644
--- a/common/pk-utils.c
+++ b/common/pk-utils.c
@@ -92,7 +92,7 @@ pk_print_binary (void (*puts_fn) (const char *str),
   if (size != 64 && size != 32 && size != 16 && size != 8
       && size != 4)
     {
-      snprintf (b, sizeof(b), "(%sint<%d>) ", sign ? "" : "u", size);
+      snprintf (b, sizeof (b), "(%sint<%d>) ", sign ? "" : "u", size);
       puts_fn (b);
     }

@@ -119,7 +119,7 @@ pk_print_binary (void (*puts_fn) (const char *str),
  * Returns the malloc'ed concatenated string or NULL when out of memory.
  */
 char *
-pk_str_concat(const char *s0, ...)
+pk_str_concat (const char *s0, ...)
 {
   va_list args;
   size_t len = 0;
diff --git a/common/pk-utils.h b/common/pk-utils.h
index b08d42da..2cc04e18 100644
--- a/common/pk-utils.h
+++ b/common/pk-utils.h
@@ -51,7 +51,7 @@ uint64_t pk_upow (uint64_t base, uint32_t exp);
 void pk_print_binary (void (*puts_fn) (const char *str), uint64_t val, int 
size, int sign);

 /* Concatenate string arguments into an malloc'ed string. */
-char *pk_str_concat(const char *s0, ...);
+char *pk_str_concat (const char *s0, ...);

 /* Replace all occurrences of SEARCH within IN by REPLACE. */
 char *pk_str_replace (const char *in, const char *search, const char *replace);
diff --git a/libpoke/ios.c b/libpoke/ios.c
index 42e67f61..36ddae91 100644
--- a/libpoke/ios.c
+++ b/libpoke/ios.c
@@ -665,7 +665,7 @@ ios_read_int_common (ios io, ios_off offset, int flags,
     return IOS_OK;

   default:
-    assert(0);
+    assert (0);
   }
 }

@@ -783,8 +783,8 @@ ios_read_int (ios io, ios_off offset, int flags,
     }

   /* Fall into the case for the unaligned and the sizes other than 8x.  */
-  int ret_val = ios_read_int_common(io, offset, flags, bits, endian,
-                                    (uint64_t *) value);
+  int ret_val = ios_read_int_common (io, offset, flags, bits, endian,
+                                     (uint64_t *) value);
   if (ret_val == IOS_OK)
     {
       *value <<= 64 - bits;
diff --git a/libpoke/pvm-val.c b/libpoke/pvm-val.c
index 41737959..b428f745 100644
--- a/libpoke/pvm-val.c
+++ b/libpoke/pvm-val.c
@@ -820,7 +820,7 @@ pvm_print_val_1 (pvm vm, int depth, int mode, int base, int 
indent,
           if ((acutoff != 0) && (acutoff <= idx))
             {
               pk_term_class ("ellipsis");
-              pk_puts("...");
+              pk_puts ("...");
               pk_term_end_class ("ellipsis");
               break;
             }
diff --git a/poke/pk-cmd-set.c b/poke/pk-cmd-set.c
index f851faf6..cc88609d 100644
--- a/poke/pk-cmd-set.c
+++ b/poke/pk-cmd-set.c
@@ -250,7 +250,7 @@ pk_cmd_set_odepth (int argc, struct pk_cmd_arg argv[], 
uint64_t uflags)
 {
   /* set odepth [DEPTH]  */

-  assert(argc == 1);
+  assert (argc == 1);

   if (PK_CMD_ARG_TYPE (argv[0]) == PK_CMD_ARG_NULL)
     pk_printf ("%d\n", pk_odepth (poke_compiler));
@@ -278,7 +278,7 @@ pk_cmd_set_oindent (int argc, struct pk_cmd_arg argv[], 
uint64_t uflags)
 {
   /* set oindent [INDENT]  */

-  assert(argc == 1);
+  assert (argc == 1);

   if (PK_CMD_ARG_TYPE (argv[0]) == PK_CMD_ARG_NULL)
     pk_printf ("%d\n", pk_oindent (poke_compiler));
@@ -346,7 +346,7 @@ pk_cmd_set_omode (int argc, struct pk_cmd_arg argv[], 
uint64_t uflags)

   enum pk_omode omode;

-  assert(argc == 1);
+  assert (argc == 1);

   if (PK_CMD_ARG_TYPE (argv[0]) == PK_CMD_ARG_NULL)
     {
diff --git a/poke/pk-hserver.c b/poke/pk-hserver.c
index 22203d37..3e0af963 100644
--- a/poke/pk-hserver.c
+++ b/poke/pk-hserver.c
@@ -342,13 +342,13 @@ pk_hserver_make_hyperlink (char type,

   token = pk_hserver_get_token ();

-  if (asprintf(&str, "app://%s:%d/%d/%c/%s",
-               hostname,
-               hserver_port,
-               token,
-               type,
-               cmd
-               ) == -1)
+  if (asprintf (&str, "app://%s:%d/%d/%c/%s",
+                hostname,
+                hserver_port,
+                token,
+                type,
+                cmd
+                ) == -1)
     {
       return NULL;
     }
diff --git a/poke/pk-mi.c b/poke/pk-mi.c
index 9b61873f..c3ea5f67 100644
--- a/poke/pk-mi.c
+++ b/poke/pk-mi.c
@@ -161,7 +161,7 @@ pk_mi_send_frame_msg (const char *payload)
 }

 /* Set fd to non-blocking and return old flags or -1 on error. */
-static int pk_mi_fd_set_nonblocking(int fd)
+static int pk_mi_fd_set_nonblocking (int fd)
 {
   int flags = fcntl (fd, F_GETFL, 0);

@@ -178,7 +178,7 @@ static int pk_mi_fd_set_nonblocking(int fd)
 }

 /* Restore flags to fd if it was set to blocking previously. */
-static void pk_mi_fd_restore_blocking(int fd, int flags)
+static void pk_mi_fd_restore_blocking (int fd, int flags)
 {
   if (flags >= 0 && (flags & O_NONBLOCK) == 0)
     {
@@ -202,7 +202,7 @@ pk_mi_loop (int fd)

   /* Make sure that fd is non-blocking.
    * From 'man 2 select':
-   *  On Linux, select() may report a socket file descriptor as
+   *  On Linux, select may report a socket file descriptor as
    *  "ready for reading", while nevertheless a subsequent read blocks." */
   old_flags = pk_mi_fd_set_nonblocking (fd);

diff --git a/poke/pk-repl.c b/poke/pk-repl.c
index 34dcdc99..676d5142 100644
--- a/poke/pk-repl.c
+++ b/poke/pk-repl.c
@@ -205,8 +205,8 @@ poke_sigint_handler (int status)
   rl_free_line_state ();
   rl_cleanup_after_signal ();
   rl_line_buffer[rl_point = rl_end = rl_mark = 0] = 0;
-  printf("\n");
-  siglongjmp(ctrlc_buf, 1);
+  printf ("\n");
+  siglongjmp (ctrlc_buf, 1);
 }

 /* Return a copy of TEXT, with every instance of the space character
@@ -269,7 +269,7 @@ pk_repl (void)
     {
       char *line;

-      while ( sigsetjmp( ctrlc_buf, 1 ) != 0 );
+      while (sigsetjmp (ctrlc_buf, 1) != 0);

       pk_term_flush ();
       rl_completion_entry_function = poke_completion_function;
diff --git a/poke/poke.c b/poke/poke.c
index 7ffcce47..77714e20 100644
--- a/poke/poke.c
+++ b/poke/poke.c
@@ -74,7 +74,7 @@ int poke_quiet_p;
 char *poke_datadir;

 /* The following global contains the directory holding the program's
-   info file(s).  */
+   info files.  */

 char *poke_infodir;

--
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]