[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 02/14: [grops]: Give an assertion some potency.
From: |
G. Branden Robinson |
Subject: |
[groff] 02/14: [grops]: Give an assertion some potency. |
Date: |
Mon, 1 Nov 2021 09:19:37 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 32a49e3a01314d8395efdb60e6bfb7ff3ac585f7
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Oct 31 11:35:58 2021 +1100
[grops]: Give an assertion some potency.
* src/devices/grops/ps.cpp (encode_subfont): Update assertion to check
for `sub` parameter being a null pointer rather than `sub->glyphs`;
the latter is a member array of a `subencoding` struct so it can't be
a null pointer. (`glyphs` is an array of pointers to `const char`;
the _elements_ of the array can [and are initialized to] be null
pointers, but the address of the array itself will never be in a C/C++
implementation.) Detected by Clang 13's
"-Wtautological-pointer-compare".
Also update editor aid comments, dropping old-style Emacs file-local
variable.
---
ChangeLog | 11 +++++++++++
src/devices/grops/ps.cpp | 9 +++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 99f3e2e..22cbe4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2021-10-31 G. Branden Robinson <g.branden.robinson@gmail.com>
+ * src/devices/grops/ps.cpp (encode_subfont): Update assertion to
+ check for `sub` parameter being a null pointer rather than
+ `sub->glyphs`; the latter is a member array of a `subencoding`
+ struct so it can't be a null pointer. (`glyphs` is an array of
+ pointers to `const char`; the _elements_ of the array can [and
+ are initialized to] be null pointers, but the address of the
+ array itself will never be in a C/C++ implementation.) Detected
+ by Clang 13's "-Wtautological-pointer-compare".
+
+2021-10-31 G. Branden Robinson <g.branden.robinson@gmail.com>
+
* src/libs/libgroff/new.cpp (delete): Declare `throw()` (no
exceptions thrown); quiets "-Wimplicit-exception-spec-mismatch"
from Clang 13.
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index 8bbc166..804e4f5 100644
--- a/src/devices/grops/ps.cpp
+++ b/src/devices/grops/ps.cpp
@@ -1,4 +1,3 @@
-// -*- C++ -*-
/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
@@ -851,7 +850,7 @@ void ps_printer::encode_fonts()
void ps_printer::encode_subfont(subencoding *sub)
{
- assert(sub->glyphs != 0);
+ assert(sub != 0);
out.put_literal_symbol(make_subencoding_name(sub->idx))
.put_delimiter('[');
for (int i = 0; i < 256; i++)
@@ -1873,3 +1872,9 @@ static void usage(FILE *stream)
" [-F dir] [files ...]\n",
program_name);
}
+
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 02/14: [grops]: Give an assertion some potency.,
G. Branden Robinson <=