Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Do not cast to the same type #6175

Merged
merged 2 commits into from
Apr 8, 2020
Merged

*: Do not cast to the same type #6175

merged 2 commits into from
Apr 8, 2020

Conversation

ton31337
Copy link
Member

@ton31337 ton31337 commented Apr 7, 2020

No description provided.

Copy link

@polychaeta polychaeta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution to FRR!

Click for style suggestions

To apply these suggestions:

curl -s https://gist.githubusercontent.com/polychaeta/ff143f3fcc8bc3ea39bb7f27a767c580/raw/49b3524ae82fe82556596e3b37b194752107ecfd/cr_6175_1586255650.diff | git apply

diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 529a49f22..b1fedfc8a 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2204,8 +2204,7 @@ bgp_attr_ext_communities(struct bgp_attr_parser_args *args)
 		return BGP_ATTR_PARSE_PROCEED;
 	}
 
-	attr->ecommunity =
-		ecommunity_parse(stream_pnt(peer->curr), length);
+	attr->ecommunity = ecommunity_parse(stream_pnt(peer->curr), length);
 	/* XXX: fix ecommunity_parse to use stream API */
 	stream_forward_getp(peer->curr, length);
 
diff --git a/lib/md5.c b/lib/md5.c
index 5c93c7bc1..d1eef0481 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -429,7 +429,7 @@ void hmac_md5(unsigned char *text, int text_len, unsigned char *key,
 						* pass */
 	MD5Update(&context, k_ipad, 64);       /* start with inner pad */
 	MD5Update(&context, text, text_len);   /* then text of datagram */
-	MD5Final(digest, &context); /* finish up 1st pass */
+	MD5Final(digest, &context);	    /* finish up 1st pass */
 	/*
 	 * perform outer MD5
 	 */
@@ -438,5 +438,5 @@ void hmac_md5(unsigned char *text, int text_len, unsigned char *key,
 	MD5Update(&context, k_opad, 64);       /* start with outer pad */
 	MD5Update(&context, digest, 16);       /* then results of 1st
 						* hash */
-	MD5Final(digest, &context); /* finish up 2nd pass */
+	MD5Final(digest, &context);	    /* finish up 2nd pass */
 }

If you are a new contributor to FRR, please see our contributing guidelines.

@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 7, 2020

Outdated results 💚

Basic BGPD CI results: SUCCESS, 0 tests failed

_ _
Result SUCCESS git merge/6175 cb63b9a
Date 04/07/2020
Start 06:37:31
Finish 07:03:17
Run-Time 25:46
Total 1815
Pass 1815
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2020-04-07-06:37:31.txt
Log autoscript-2020-04-07-06:38:24.log.bz2
Memory 480 484 425

For details, please contact louberger

Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching these - changes look good. Will wait 'til checks complete, though.

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Apr 7, 2020

Continuous Integration Result: FAILED

Continuous Integration Result: FAILED

See below for issues.
CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Get source / Pull Request: Successful

Building Stage: Failed

FreeBSD 12 amd64 build: Failed (click for details)

Make failed for FreeBSD 12 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/FBSD12AMD64/ErrorLog/log_make.txt)

gmake[1]: Entering directory '/usr/home/ci/cibuild.11683/frr-source'
lib/getopt.c: In function '_getopt_internal':
lib/getopt.c:542:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
 static void exchange(argv) char **argv;
lib/getopt.c:566:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
 static void exchange(argv) char **argv;
cc1: all warnings being treated as errors

FreeBSD 12 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/FBSD12AMD64/config.status/config.status

OpenBSD 6 amd64 build: Failed (click for details)

Make failed for OpenBSD 6 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI011BUILD/ErrorLog/log_make.txt)

gmake  all-am
gmake[1]: Entering directory '/home/ci/cibuild.11683/frr-source'
lib/getopt.c:542:14: error: passing 'char *const *' to parameter of type 'char **' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
lib/getopt.c:566:14: error: passing 'char *const *' to parameter of type 'char **' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
2 errors generated.
gmake[1]: *** [Makefile:7658: lib/getopt.lo] Error 1
gmake[1]: Target 'all-am' not remade because of errors.
gmake[1]: Leaving directory '/home/ci/cibuild.11683/frr-source'
gmake: *** [Makefile:4544: all] Error 2

OpenBSD 6 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI011BUILD/config.status/config.status

FreeBSD 11 amd64 build: Failed (click for details)

Make failed for FreeBSD 11 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI009BUILD/ErrorLog/log_make.txt)

gmake[1]: Entering directory '/usr/home/ci/cibuild.11683/frr-source'
lib/getopt.c: In function '_getopt_internal':
lib/getopt.c:542:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:35: note: expected 'char **' but argument is of type 'char * const*'
lib/getopt.c:566:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:35: note: expected 'char **' but argument is of type 'char * const*'
cc1: all warnings being treated as errors
gmake[1]: *** [Makefile:7659: lib/getopt.lo] Error 1
gmake[1]: Leaving directory '/usr/home/ci/cibuild.11683/frr-source'

FreeBSD 11 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI009BUILD/config.status/config.status

NetBSD 8 amd64 build: Failed (click for details)

Make failed for NetBSD 8 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI012BUILD/ErrorLog/log_make.txt)

gmake[1]: Entering directory '/home/ci/cibuild.11683/frr-source'
lib/getopt.c: In function '_getopt_internal':
lib/getopt.c:542:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
 static void exchange(argv) char **argv;
lib/getopt.c:566:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
 static void exchange(argv) char **argv;
cc1: all warnings being treated as errors

NetBSD 8 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI012BUILD/config.status/config.status

NetBSD 6 amd64 build: Failed (click for details)

Make failed for NetBSD 6 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI007BUILD/ErrorLog/log_make.txt)

/usr/pkg/lib/libpython2.7.so: warning: warning: tmpnam() possibly used unsafely, use mkstemp() or mkdtemp()
/usr/pkg/lib/libpython2.7.so: warning: warning: tempnam() possibly used unsafely, use mkstemp() or mkdtemp()
cc1: warnings being treated as errors
lib/getopt.c: In function '_getopt_internal':
lib/getopt.c:542:5: error: passing argument 1 of 'exchange' discards qualifiers from pointer target type
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
lib/getopt.c:566:5: error: passing argument 1 of 'exchange' discards qualifiers from pointer target type
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
gmake[1]: *** [Makefile:7182: lib/getopt.lo] Error 1

NetBSD 6 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI007BUILD/config.status/config.status

Successful on other platforms/tests
  • Ubuntu 18.04 amd64 build
  • Ubuntu 14.04 amd64 build
  • Debian 8 amd64 build
  • Ubuntu 18.04 ppc64le build
  • Debian 9 amd64 build
  • CentOS 7 amd64 build
  • Ubuntu 16.04 amd64 build
  • Ubuntu 12.04 amd64 build
  • Ubuntu 16.04 i386 build
  • Fedora 29 amd64 build
  • Debian 10 amd64 build

Warnings Generated during build:

Checkout code: Successful with additional warnings
FreeBSD 12 amd64 build: Failed (click for details)

Make failed for FreeBSD 12 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/FBSD12AMD64/ErrorLog/log_make.txt)

gmake[1]: Entering directory '/usr/home/ci/cibuild.11683/frr-source'
lib/getopt.c: In function '_getopt_internal':
lib/getopt.c:542:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
 static void exchange(argv) char **argv;
lib/getopt.c:566:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
 static void exchange(argv) char **argv;
cc1: all warnings being treated as errors

FreeBSD 12 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/FBSD12AMD64/config.status/config.status

OpenBSD 6 amd64 build: Failed (click for details)

Make failed for OpenBSD 6 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI011BUILD/ErrorLog/log_make.txt)

gmake  all-am
gmake[1]: Entering directory '/home/ci/cibuild.11683/frr-source'
lib/getopt.c:542:14: error: passing 'char *const *' to parameter of type 'char **' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
lib/getopt.c:566:14: error: passing 'char *const *' to parameter of type 'char **' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
2 errors generated.
gmake[1]: *** [Makefile:7658: lib/getopt.lo] Error 1
gmake[1]: Target 'all-am' not remade because of errors.
gmake[1]: Leaving directory '/home/ci/cibuild.11683/frr-source'
gmake: *** [Makefile:4544: all] Error 2

OpenBSD 6 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI011BUILD/config.status/config.status

FreeBSD 11 amd64 build: Failed (click for details)

Make failed for FreeBSD 11 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI009BUILD/ErrorLog/log_make.txt)

gmake[1]: Entering directory '/usr/home/ci/cibuild.11683/frr-source'
lib/getopt.c: In function '_getopt_internal':
lib/getopt.c:542:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:35: note: expected 'char **' but argument is of type 'char * const*'
lib/getopt.c:566:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:35: note: expected 'char **' but argument is of type 'char * const*'
cc1: all warnings being treated as errors
gmake[1]: *** [Makefile:7659: lib/getopt.lo] Error 1
gmake[1]: Leaving directory '/usr/home/ci/cibuild.11683/frr-source'

FreeBSD 11 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI009BUILD/config.status/config.status

NetBSD 8 amd64 build: Failed (click for details)

Make failed for NetBSD 8 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI012BUILD/ErrorLog/log_make.txt)

gmake[1]: Entering directory '/home/ci/cibuild.11683/frr-source'
lib/getopt.c: In function '_getopt_internal':
lib/getopt.c:542:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
 static void exchange(argv) char **argv;
lib/getopt.c:566:14: error: passing argument 1 of 'exchange' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
 static void exchange(argv) char **argv;
cc1: all warnings being treated as errors

NetBSD 8 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI012BUILD/config.status/config.status

NetBSD 6 amd64 build: Failed (click for details)

Make failed for NetBSD 6 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI007BUILD/ErrorLog/log_make.txt)

/usr/pkg/lib/libpython2.7.so: warning: warning: tmpnam() possibly used unsafely, use mkstemp() or mkdtemp()
/usr/pkg/lib/libpython2.7.so: warning: warning: tempnam() possibly used unsafely, use mkstemp() or mkdtemp()
cc1: warnings being treated as errors
lib/getopt.c: In function '_getopt_internal':
lib/getopt.c:542:5: error: passing argument 1 of 'exchange' discards qualifiers from pointer target type
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
lib/getopt.c:566:5: error: passing argument 1 of 'exchange' discards qualifiers from pointer target type
lib/getopt.c:297:13: note: expected 'char **' but argument is of type 'char * const*'
gmake[1]: *** [Makefile:7182: lib/getopt.lo] Error 1

NetBSD 6 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11683/artifact/CI007BUILD/config.status/config.status

Report for md5.c | 9 issues
===============================================
< ERROR: bzero() is deprecated; use memset()#415: FILE: /tmp/f1-2540/md5.c:415:
---
> ERROR: bzero() is deprecated; use memset()#415: FILE: /tmp/f2-2540/md5.c:415:
25c25
< ERROR: bzero() is deprecated; use memset()#416: FILE: /tmp/f1-2540/md5.c:416:
---
> ERROR: bzero() is deprecated; use memset()#416: FILE: /tmp/f2-2540/md5.c:416:
29c29
< #429: FILE: /tmp/f1-2540/md5.c:429:
Report for start-stop-daemon.c | 5 issues
===============================================
< WARNING: strncpy() is error-prone; please use strlcpy() if possible, or memcpy()#756: FILE: /tmp/f1-2540/start-stop-daemon.c:756:
---
> WARNING: strncpy() is error-prone; please use strlcpy() if possible, or memcpy()#756: FILE: /tmp/f2-2540/start-stop-daemon.c:756:
145c145
< #919: FILE: /tmp/f1-2540/start-stop-daemon.c:919:

Copy link
Member

@rwestphal rwestphal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this a lot!

To fix the CI errors I'd just withdraw the change on lib/getopt.c since argv can be either char *const * or char **argv depending on the platform and some configure-time checks. Hence the explicit casts are necessary there.

@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 8, 2020

Outdated results 💚

Basic BGPD CI results: SUCCESS, 0 tests failed

_ _
Result SUCCESS git merge/6175 0bed7d4
Date 04/08/2020
Start 02:02:32
Finish 02:28:16
Run-Time 25:44
Total 1815
Pass 1815
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2020-04-08-02:02:32.txt
Log autoscript-2020-04-08-02:03:25.log.bz2
Memory 500 477 422

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Apr 8, 2020

Continuous Integration Result: SUCCESSFUL

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11713/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Checkout code: Successful with additional warnings
Report for md5.c | 9 issues
===============================================
< ERROR: bzero() is deprecated; use memset()#415: FILE: /tmp/f1-17378/md5.c:415:
---
> ERROR: bzero() is deprecated; use memset()#415: FILE: /tmp/f2-17378/md5.c:415:
25c25
< ERROR: bzero() is deprecated; use memset()#416: FILE: /tmp/f1-17378/md5.c:416:
---
> ERROR: bzero() is deprecated; use memset()#416: FILE: /tmp/f2-17378/md5.c:416:
29c29
< #429: FILE: /tmp/f1-17378/md5.c:429:
Report for start-stop-daemon.c | 5 issues
===============================================
< WARNING: strncpy() is error-prone; please use strlcpy() if possible, or memcpy()#756: FILE: /tmp/f1-17378/start-stop-daemon.c:756:
---
> WARNING: strncpy() is error-prone; please use strlcpy() if possible, or memcpy()#756: FILE: /tmp/f2-17378/start-stop-daemon.c:756:
145c145
< #919: FILE: /tmp/f1-17378/start-stop-daemon.c:919:

Warnings Generated during build:

Debian 10 amd64 build: Successful with additional warnings

Debian Package lintian failed for Debian 10 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11713/artifact/DEB10BUILD/ErrorLog/log_lintian.txt)

W: frr source: newer-standards-version 4.4.1 (current is 4.3.0)

Copy link
Contributor

@eqvinox eqvinox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some leftover braces to remove, other than that ACK

bgpd/rfapi/rfapi_rib.c Outdated Show resolved Hide resolved
bgpd/rfapi/rfapi_vty.c Outdated Show resolved Hide resolved
pimd/pim_hello.c Outdated Show resolved Hide resolved
pimd/pim_sock.c Outdated Show resolved Hide resolved
pimd/pim_sock.c Outdated Show resolved Hide resolved
ton31337 added 2 commits April 8, 2020 17:15
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11727/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Checkout code: Successful with additional warnings
Report for md5.c | 9 issues
===============================================
< ERROR: bzero() is deprecated; use memset()#415: FILE: /tmp/f1-9734/md5.c:415:
---
> ERROR: bzero() is deprecated; use memset()#415: FILE: /tmp/f2-9734/md5.c:415:
25c25
< ERROR: bzero() is deprecated; use memset()#416: FILE: /tmp/f1-9734/md5.c:416:
---
> ERROR: bzero() is deprecated; use memset()#416: FILE: /tmp/f2-9734/md5.c:416:
29c29
< #429: FILE: /tmp/f1-9734/md5.c:429:
Report for start-stop-daemon.c | 5 issues
===============================================
< WARNING: strncpy() is error-prone; please use strlcpy() if possible, or memcpy()#756: FILE: /tmp/f1-9734/start-stop-daemon.c:756:
---
> WARNING: strncpy() is error-prone; please use strlcpy() if possible, or memcpy()#756: FILE: /tmp/f2-9734/start-stop-daemon.c:756:
145c145
< #919: FILE: /tmp/f1-9734/start-stop-daemon.c:919:

Warnings Generated during build:

Debian 10 amd64 build: Successful with additional warnings

Debian Package lintian failed for Debian 10 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11727/artifact/DEB10BUILD/ErrorLog/log_lintian.txt)

W: frr source: newer-standards-version 4.4.1 (current is 4.3.0)

@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 8, 2020

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/6175 ff8b039
Date 04/08/2020
Start 11:37:10
Finish 12:03:01
Run-Time 25:51
Total 1815
Pass 1815
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2020-04-08-11:37:10.txt
Log autoscript-2020-04-08-11:38:06.log.bz2
Memory 473 471 425

For details, please contact louberger

@eqvinox eqvinox merged commit 2ee1e4b into FRRouting:master Apr 8, 2020
@ton31337 ton31337 deleted the fix/avoid_same_type_typecasting branch April 8, 2020 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants