Bug 2509 - Fix harmless unused variable warning
: Fix harmless unused variable warning
Status: RESOLVED LATER
: libtiff
default
: unspecified
: All All
: P4 enhancement
: ---
Assigned To:
:
:
: migrated_to_gitlab
:
:
  Show dependency treegraph
 
Reported: 2015-04-12 11:14 by
Modified: 2019-10-01 14:20 (History)


Attachments
Patch fixing the warning (1.21 KB, patch)
2015-04-12 17:26, Vadim Zeitlin
Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2015-04-12 11:14:14
Building libtiff in production/optimized mode, i.e. with NDEBUG defined,
results in the following warning

libtiff/tif_open.c:105:5: warning: variable 'n' set but not used
[-Wunused-but-set-variable]

The following trivial patch (also attached to preserve tabs in it) fixes it
without changing the library behaviour in any way:

diff --git a/libtiff/tif_open.c b/libtiff/tif_open.c
index 561d91d..e394a2d 100644
--- a/libtiff/tif_open.c
+++ b/libtiff/tif_open.c
@@ -90,6 +90,7 @@ TIFFClientOpen(
        /* The following are configuration checks. They should be redundant,
but should not
         * compile to any actual code in an optimised release build anyway. If
any of them
         * fail, (makefile-based or other) configuration is not correct */
+#ifndef NDEBUG
        assert(sizeof(uint8)==1);
        assert(sizeof(int8)==1);
        assert(sizeof(uint16)==2);
@@ -112,6 +113,7 @@ TIFFClientOpen(
                assert(n.a16==1);
                #endif
        }
+#endif /* !NDEBUG */

        m = _TIFFgetMode(mode, module);
        if (m == -1)
------- Comment #1 From 2015-04-12 17:26:25 -------
Created an attachment (id=625) [details]
Patch fixing the warning
------- Comment #2 From 2019-10-01 14:20:03 -------
Bugzilla is no longer used for tracking libtiff issues. Remaining open tickets,
such as this one, have been migrated to the libtiff GitLab instance at
https://gitlab.com/libtiff/libtiff/issues .

The migrated tickets have their summary prefixed with [BZ#XXXX] where XXXX is
the initial Bugzilla issue number.