2024-04-27 18:40 BST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002870LibCSSLibCSSpublic2024-03-09 04:21
ReporterRichard Bauer 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Platformi686-linuxOSGNU GuixOS Version
Summary0002870: 0.9.2 tests fail to build on 32-bit system
DescriptionWhen attempting to compile libcss tests for a i686-linux system, I get the following error:

```
In file included from test/css21.c:11:
test/dump.h: In function ‘dump_rule_media’:
test/dump.h:134:45: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
  134 | ptr += sprintf(ptr, "| @media %s%03lx",
      | ~~~~^
      | |
      | long unsigned int
      | %03llx
  135 | s->media->negate_type ? "not " : "",
  136 | s->media->type);
      | ~~~~~~~~~~~~~~
      | |
      | uint64_t {aka long long unsigned int}
In file included from test/parse2-auto.c:12:
test/dump.h: In function ‘dump_rule_media’:
test/dump.h:134:45: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
  134 | ptr += sprintf(ptr, "| @media %s%03lx",
      | ~~~~^
      | |
      | long unsigned int
      | %03llx
  135 | s->media->negate_type ? "not " : "",
  136 | s->media->type);
      | ~~~~~~~~~~~~~~
      | |
      | uint64_t {aka long long unsigned int}
 COMPILE: test/select.c
    LINK: build-i686-unknown-linux-gnu-i686-unknown-linux-gnu-release-lib-shared/test_lex
    LINK: build-i686-unknown-linux-gnu-i686-unknown-linux-gnu-release-lib-shared/test_parse
    LINK: build-i686-unknown-linux-gnu-i686-unknown-linux-gnu-release-lib-shared/test_csdetect
    LINK: build-i686-unknown-linux-gnu-i686-unknown-linux-gnu-release-lib-shared/test_number
    LINK: build-i686-unknown-linux-gnu-i686-unknown-linux-gnu-release-lib-shared/test_lex-auto
    LINK: build-i686-unknown-linux-gnu-i686-unknown-linux-gnu-release-lib-shared/test_parse-auto
cc1: all warnings being treated as errors
```

The format specifier `%lx` does not match the `uint64_t` declaration on 32-bit systems, where `long int` is not 64 bits wide.

Anyhow, the following patch appears to fix the issue:

```
--- a/test/dump.h
+++ b/test/dump.h
@@ -131,7 +131,7 @@ void dump_rule_media(css_rule_media *s, char **buf, size_t *buflen)
        char *ptr = *buf;
        css_rule *rule;
 
- ptr += sprintf(ptr, "| @media %s%03lx",
+ ptr += sprintf(ptr, "| @media %s%03" PRIx64,
                        s->media->negate_type ? "not " : "",
                        s->media->type);
```

since the <inttypes.h> header is already in use.
TagsNo tags attached.
Fixed in CI build #
Reported in CI build #
Attached Files

-Relationships
+Relationships

-Notes
There are no notes attached to this issue.
+Notes

-Issue History
Date Modified Username Field Change
2024-03-09 04:21 Richard Bauer New Issue
+Issue History