PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.62k stars 904 forks source link

Compiler warnings on aarch64 #10499

Closed pieterlexis closed 2 years ago

pieterlexis commented 3 years ago

Short description

When building dnsdist I see a few compiler warnings.

Environment

Steps to reproduce

./builder/build.sh -v -m dnsdist debian-buster-arm64

Expected behaviour

No warnings

Actual behaviour

dnslabeltext.rl: In function 'DNSName::string_t segmentDNSNameRaw(const char*, size_t)':
dnslabeltext.rl:115:38: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  115 |                         if (labellen < 0 || labellen > 63) {
      |                             ~~~~~~~~~^~~
dnslabeltext.rl:115:38: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  115 |                         if (labellen < 0 || labellen > 63) {
      |                             ~~~~~~~~~^~~
dnsname.cc: In member function 'bool DNSName::isPartOf(const DNSName&) const':
dnsname.cc:258:13: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  258 |     if (*us < 0) {
      |         ~~~~^~~
rgacogne commented 3 years ago

Partial duplicate of https://github.com/PowerDNS/pdns/issues/10404, FWIW.

omoerbeek commented 3 years ago

on aarch64, char is unsigned. That explains the warnings. A safe way is to switch to signed char, this will keep the behaviour the same on e.g. amd64. Switching to unsigned char often requires some extra thought.

alm-nl commented 2 years ago

I'm trying to compile PowerDNS 4.6.1 Authoritative for aarch64 as no 4.6.1 packages are availables for Oracle Linux 8 ARM64 systems and I'm getting the same warnings as mentioned above when using the ./builder/build.sh buildmethod.

Additionally I'm getting the following:

bindparser.cc:260:5: warning: redundant redeclaration of 'int yyparse()' in same scope [-Wredundant-decls]
 int yyparse (void);
     ^~~~~~~
bindparser.yy:22:6: note: previous declaration of 'int yyparse()'
  int yyparse(void);
      ^~~~~~~

I can't find the bindparser.cc file, but the bindparser.yy file exists. Am I missing something?

I've added signed before char in line 111 of dnslabeltext.rl file and that error is gone. Hopefully that is indeed the right fix?

I don't get what needs to be changed in dnsname.cc to fix that?

I'm no programmer, so it would help if someone can tell me what to change for the build to be without errors.

Are there plans to create packages for Oracle Linux 8 ARM64, there are packages in the EPEL repo for 4.6.0 but not for 4.6.1 unfortunately?

Thank you.

Habbie commented 2 years ago

I can't find the bindparser.cc file, but the bindparser.yy file exists. Am I missing something?

We have found it impossible to fix the yyparse warning consistently. However, you can ignore it.

I've added signed before char in line 111 of dnslabeltext.rl file and that error is gone. Hopefully that is indeed the right fix?

It's not an error, it's a warning. I believe you can ignore it as well.

Are there plans to create packages for Oracle Linux 8 ARM64, there are packages in the EPEL repo for 4.6.0 but not for 4.6.1 unfortunately?

Yes, there are plans. No date has been set.

alm-nl commented 2 years ago

Thank you, while it seems to work to build packages it would be nice to have official builds to use. Luckily it's just my private testing and learning environment for PowerDNS (on Oracle Cloud Free Tier with ARM64 based vm's). Still have to see if my build works though.

Habbie commented 2 years ago

Until then, you may find https://blog.powerdns.com/2013/10/28/on-ragel-and-char-types/ an interesting read (although it provides no answers!)

omoerbeek commented 2 years ago

Fixed in #11719