]> git.eshelyaron.com Git - emacs.git/commitdiff
Check instead of relying on NOTREACHED
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 31 Aug 2019 17:35:08 +0000 (10:35 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 31 Aug 2019 18:01:46 +0000 (11:01 -0700)
NOTREACHED was designed for traditional lint decades ago,
and _Noreturn now normally subsumes its function.
In the one case in Emacs where NORETURN might help and _Noreturn does
not, check for NOTREACHED instead of assuming it.
* lib-src/etags.c (main):
* src/xterm.c (x_connection_closed):
Remove NOTREACHED after a call to a _Noreturn function, as NOTREACHED
is no longer needed there.  Also, one of the NOTREACHEDs was
misplaced, which defeated traditional lint checking anyway.
* lib-src/pop.c (pop_getline): Redo so as to not need NOTREACHED.
* src/emacs.c (main): Use eassume (false) rather than NOTREACHED,
so that running with ENABLE_CHECKING catches any internal error
causing the toplevel Frecursive_edit to return.

lib-src/etags.c
lib-src/pop.c
src/emacs.c
src/xterm.c

index 036c485d0bb4d85dd915cb38fffd060ab0bddfb5..6409407e4665ebd579c6a5fc5566f62dfacf3b48 100644 (file)
@@ -1146,7 +1146,6 @@ main (int argc, char **argv)
          {
            error ("-o option may only be given once.");
            suggest_asking_for_help ();
-           /* NOTREACHED */
          }
        tagfile = optarg;
        break;
@@ -1208,7 +1207,6 @@ main (int argc, char **argv)
       case 'w': no_warnings = true;                            break;
       default:
        suggest_asking_for_help ();
-       /* NOTREACHED */
       }
 
   /* No more options.  Store the rest of arguments. */
@@ -1227,13 +1225,11 @@ main (int argc, char **argv)
 
   if (help_asked)
     print_help (argbuffer);
-    /* NOTREACHED */
 
   if (nincluded_files == 0 && file_count == 0)
     {
       error ("no input files specified.");
       suggest_asking_for_help ();
-      /* NOTREACHED */
     }
 
   if (tagfile == NULL)
index e4bd6c0496564ea83e619f97fc1fe2812e010ecd..9a0dd8ca704b01c8952cfa6847ea9100e46e5c6f 100644 (file)
@@ -1275,7 +1275,7 @@ pop_getline (popserver server, char **line)
       server->buffer_index = 0;
     }
 
-  while (1)
+  while (true)
     {
       /* There's a "- 1" here to leave room for the null that we put
          at the end of the read data below.  We put the null there so
@@ -1288,7 +1288,7 @@ pop_getline (popserver server, char **line)
            {
              strcpy (pop_error, "Out of memory in pop_getline");
              pop_trash (server);
-             return (-1);
+             break;
            }
        }
       ret = RECV (server->file, server->buffer + server->data,
@@ -1298,13 +1298,13 @@ pop_getline (popserver server, char **line)
          snprintf (pop_error, ERROR_MAX, "%s%s",
                    GETLINE_ERROR, strerror (errno));
          pop_trash (server);
-         return (-1);
+         break;
        }
       else if (ret == 0)
        {
          strcpy (pop_error, "Unexpected EOF from server in pop_getline");
          pop_trash (server);
-         return (-1);
+         break;
        }
       else
        {
@@ -1332,7 +1332,7 @@ pop_getline (popserver server, char **line)
        }
     }
 
-  /* NOTREACHED */
+  return -1;
 }
 
 /*
index cc5818393a329709977609e9812084c1558c53ce..53572d7f0c8a3dec1de1255a9485ced083418f20 100644 (file)
@@ -2084,8 +2084,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
 
   /* Enter editor command loop.  This never returns.  */
   Frecursive_edit ();
-  /* NOTREACHED */
-  return 0;
+  eassume (false);
 }
 \f
 /* Sort the args so we can find the most important ones
index 0d224063d76c5af0190216cf33004e5e1b402de3..b761eaf4d110b53ad50728611caf90f3bf370933 100644 (file)
@@ -10044,7 +10044,6 @@ For details, see etc/PROBLEMS.\n",
     {
       fprintf (stderr, "%s\n", error_msg);
       Fkill_emacs (make_fixnum (70));
-      /* NOTREACHED */
     }
 
   totally_unblock_input ();