summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2021-10-01 13:22:39 +0100
committerRobin Watts <Robin.Watts@artifex.com>2021-10-01 13:26:23 +0100
commitabd7cff390ec8d7d692bec66e74aa01e4819dece (patch)
tree5bf2f4e54cedaf8c428561672d0af3438480f942
parent830afae5454dea3bff903869d82022306890a96c (diff)
downloadghostpdl-abd7cff390ec8d7d692bec66e74aa01e4819dece.tar.gz
LGTM warning suppressions and fixes.
Fix (hopefully) the last few LGTM warnings. Suppress warnings for those things that we can't avoid (use of goto in speed critical state machines for example), and fix those we can.
-rw-r--r--base/gp_strdl.c2
-rw-r--r--base/gslibctx.c4
-rw-r--r--base/gxclfile.c5
-rw-r--r--base/gxclpage.c2
-rw-r--r--base/gxclrast.c4
-rw-r--r--base/gxstroke.c10
-rw-r--r--base/gxtype1.c2
-rw-r--r--pcl/pcl/pcommand.c2
-rw-r--r--pcl/pcl/rtgmode.c2
-rw-r--r--pcl/pxl/pxfont.c2
-rw-r--r--psi/igc.c3
-rw-r--r--psi/imain.c2
-rw-r--r--psi/interp.c3
13 files changed, 27 insertions, 16 deletions
diff --git a/base/gp_strdl.c b/base/gp_strdl.c
index d8a2f516b..69b981bc3 100644
--- a/base/gp_strdl.c
+++ b/base/gp_strdl.c
@@ -21,7 +21,7 @@
#include "gp.h"
int
-gp_readline_init(void **preadline_data, gs_memory_t * mem) /* lgtm [cpp/useless-expression] */
+gp_readline_init(void **preadline_data, gs_memory_t * mem)
{
return 0;
}
diff --git a/base/gslibctx.c b/base/gslibctx.c
index 318039fad..e0e53b782 100644
--- a/base/gslibctx.c
+++ b/base/gslibctx.c
@@ -204,7 +204,9 @@ fs_file_open_printer(const gs_memory_t *mem, void *secret, const char *fname, in
*file = NULL;
return gs_error_invalidfileaccess;
}
- gp_setmode_binary_impl(f, binary_mode);
+ /* The lgtm comment below is required because on some platforms that function
+ * does nothing. */
+ gp_setmode_binary_impl(f, binary_mode); /* lgtm [cpp/useless-expression] */
return 0;
}
diff --git a/base/gxclfile.c b/base/gxclfile.c
index f03646ec9..c7cd7b2d4 100644
--- a/base/gxclfile.c
+++ b/base/gxclfile.c
@@ -532,7 +532,10 @@ clist_fseek(clist_file_ptr cf, int64_t offset, int mode, const char *ignore_fnam
res = gp_fseek(ifile->f, offset, mode);
}
/* NB: if gp_can_share_fdesc, we don't actually seek */
- if (res >= 0) {
+ /* The following lgtm tag is required because on some platforms
+ * !gp_can_share_fdesc() is always true, so the value of res is
+ * known. On other platforms though, this is NOT true. */
+ if (res >= 0) { /* lgtm [cpp/constant-comparison] */
/* Update the ifile->pos */
switch (mode) {
case SEEK_SET:
diff --git a/base/gxclpage.c b/base/gxclpage.c
index 0e358da3d..37e6d2190 100644
--- a/base/gxclpage.c
+++ b/base/gxclpage.c
@@ -781,7 +781,7 @@ gx_saved_pages_list_print(gx_device_printer *pdev, gx_saved_pages_list *list,
break;
curr_elem = curr_elem->prev;
/* Below is not needed since we never print reverse even/odd */
- if (page_skip < -1)
+ if (page_skip < -1) /* lgtm [cpp/constant-comparison] */
curr_elem = curr_elem->prev;
}
if (curr_elem == NULL) {
diff --git a/base/gxclrast.c b/base/gxclrast.c
index bfed7ddbb..a0f208e14 100644
--- a/base/gxclrast.c
+++ b/base/gxclrast.c
@@ -473,10 +473,10 @@ read_set_misc_map(byte cb, command_buf_t *pcb, gs_gstate *pgs, gs_memory_t *mem)
}
int
-clist_playback_band(clist_playback_action playback_action,
+clist_playback_band(clist_playback_action playback_action, /* lgtm [cpp/use-of-goto] */
gx_device_clist_reader *cdev, stream *s,
gx_device *target, int x0, int y0,
- gs_memory_t * mem) /* lgtm [cpp/use-of-goto] */
+ gs_memory_t * mem)
{
byte *cbuf_storage;
command_buf_t cbuf;
diff --git a/base/gxstroke.c b/base/gxstroke.c
index 87def483e..e77023179 100644
--- a/base/gxstroke.c
+++ b/base/gxstroke.c
@@ -422,9 +422,13 @@ gx_join_path_and_reverse(gx_path * path, gx_path * rpath)
* what is wanted.
*/
static int
-gx_stroke_path_only_aux(gx_path * ppath, gx_path * to_path, gx_device * pdev,
- const gs_gstate * pgs, const gx_stroke_params * params,
- const gx_device_color * pdevc, const gx_clip_path * pcpath)
+gx_stroke_path_only_aux(gx_path *ppath, /* lgtm[cpp/use-of-goto] */
+ gx_path *to_path,
+ gx_device *pdev,
+ const gs_gstate *pgs,
+ const gx_stroke_params *params,
+ const gx_device_color *pdevc,
+ const gx_clip_path *pcpath)
{
bool CPSI_mode = gs_currentcpsimode(pgs->memory);
bool traditional = CPSI_mode | params->traditional;
diff --git a/base/gxtype1.c b/base/gxtype1.c
index 44dfab43a..d3af50ece 100644
--- a/base/gxtype1.c
+++ b/base/gxtype1.c
@@ -346,7 +346,7 @@ type1_cis_get_metrics(const gs_type1_state * pcis, double psbw[4])
* This is exported only for the benefit of font copying.
*/
int
-gs_type1_piece_codes(/*const*/ gs_font_type1 *pfont,
+gs_type1_piece_codes(/*const*/ gs_font_type1 *pfont, /* lgtm[cpp/use-of-goto] */
const gs_glyph_data_t *pgd, gs_char *chars)
{
gs_type1_data *const pdata = &pfont->data;
diff --git a/pcl/pcl/pcommand.c b/pcl/pcl/pcommand.c
index fd9c6df0c..b81894dc7 100644
--- a/pcl/pcl/pcommand.c
+++ b/pcl/pcl/pcommand.c
@@ -224,7 +224,7 @@ pcl_do_resets(pcl_state_t * pcs, pcl_reset_type_t type)
return pcl_do_resets_permanent(pcs);
}
- for (; *init && code >= 0; ++init) {
+ for (; *init; ++init) {
if ((*init)->do_reset) {
code = (*(*init)->do_reset) (pcs, type);
if (code < 0)
diff --git a/pcl/pcl/rtgmode.c b/pcl/pcl/rtgmode.c
index 8e921b2d2..d6fd7f5a3 100644
--- a/pcl/pcl/rtgmode.c
+++ b/pcl/pcl/rtgmode.c
@@ -551,7 +551,7 @@ set_compression_method(pcl_args_t * pargs, pcl_state_t * pcs)
pcs->raster_state.compression_mode = mode;
/* CCITT compression modes are always monochrome - install the
monochrome palette and restart raster. */
- if (mode >= 6 && mode <= 9) {
+ if (mode >= 6 && mode <= 9) { /* lgtm [cpp/constant-comparison] */
pcl_palette_CCITT_raster(pcs);
if (pcs->raster_state.graphics_mode) {
coord x = pcs->cap.x;
diff --git a/pcl/pxl/pxfont.c b/pcl/pxl/pxfont.c
index 178fd30fe..b7e4013bf 100644
--- a/pcl/pxl/pxfont.c
+++ b/pcl/pxl/pxfont.c
@@ -248,7 +248,7 @@ px_define_font(px_font_t * pxfont, byte * header, ulong size, gs_id id,
if (header[4] == plfst_TrueType) {
pxfont->is_xl_format = true;
- pl_prepend_xl_dummy_header(mem, &header);
+ pl_prepend_xl_dummy_header(mem, &header); /* lgtm [cpp/useless-expression] */
pxfont->header = header;
pxfont->header_size = gs_object_size(mem, header);
} else {
diff --git a/psi/igc.c b/psi/igc.c
index 420a013a0..373cdcc36 100644
--- a/psi/igc.c
+++ b/psi/igc.c
@@ -786,7 +786,8 @@ gc_trace_clump(const gs_memory_t *mem, clump_t * cp, gc_state_t * pstate, gc_mar
/* 1 if we completed and marked some new objects. */
static int gc_extend_stack(gc_mark_stack *, gc_state_t *);
static int
-gc_trace(gs_gc_root_t * rp, gc_state_t * pstate, gc_mark_stack * pmstack)
+gc_trace(gs_gc_root_t * rp, /* lgtm [cpp/use-of-goto] */
+ gc_state_t * pstate, gc_mark_stack * pmstack)
{
int min_trace = pstate->min_collect;
gc_mark_stack *pms = pmstack;
diff --git a/psi/imain.c b/psi/imain.c
index 72064aba8..265859321 100644
--- a/psi/imain.c
+++ b/psi/imain.c
@@ -531,7 +531,7 @@ gs_main_init2(gs_main_instance * minst)
if (code >= 0) {
if (gs_debug_c(':'))
print_resource_usage(minst, &gs_imemory, "Start");
- gp_readline_init(&minst->readline_data, minst->heap);
+ gp_readline_init(&minst->readline_data, minst->heap); /* lgtm [cpp/useless-expression] */
}
fail:
diff --git a/psi/interp.c b/psi/interp.c
index 2cf9d4a61..b8393006f 100644
--- a/psi/interp.c
+++ b/psi/interp.c
@@ -910,7 +910,8 @@ gs_errorinfo_put_string(i_ctx_t *i_ctx_p, const char *str)
/* If an error occurs, leave the current object in *perror_object */
/* and return a (negative) error code. */
static int
-interp(i_ctx_t **pi_ctx_p /* context for execution, updated if resched */,
+interp(/* lgtm [cpp/use-of-goto] */
+ i_ctx_t **pi_ctx_p /* context for execution, updated if resched */,
const ref * pref /* object to interpret */,
ref * perror_object)
{