* [PATCH 0/4] build system fixes
@ 2019-11-02 10:40 Eric Wong
2019-11-02 10:40 ` [PATCH 1/4] Makefile.PL: remove CCFLAGS overrides Eric Wong
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Eric Wong @ 2019-11-02 10:40 UTC (permalink / raw)
To: mwrap-perl
Perl (as distributed by Debian) disables assertions and
enables fewer warnings than I'd like. Now, I'm using config.mak
to set a bunch of warnings and seeing some noise, these fix it.
Eric Wong (4):
Makefile.PL: remove CCFLAGS overrides
workaround -DNDEBUG warnings
quiet uninitialized variable warnings
avoid mixing declarations and code
Makefile.PL | 7 -------
Mwrap.xs | 26 +++++++++++++++-----------
2 files changed, 15 insertions(+), 18 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] Makefile.PL: remove CCFLAGS overrides
2019-11-02 10:40 [PATCH 0/4] build system fixes Eric Wong
@ 2019-11-02 10:40 ` Eric Wong
2019-11-02 10:40 ` [PATCH 2/4] workaround -DNDEBUG warnings Eric Wong
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2019-11-02 10:40 UTC (permalink / raw)
To: mwrap-perl; +Cc: Eric Wong
From: Eric Wong <e@80x24.org>
Blindly copied from a C++ project :P
---
Makefile.PL | 7 -------
1 file changed, 7 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index dc7d6dd..a7d131d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -29,12 +29,6 @@ END
# may be empty
chomp(my $INC = `$pkg_config --cflags liburcu-cds liburcu-bp`);
my @writemakefile_args = ();
-# Filter out some gcc options which g++ doesn't support.
-my $CCFLAGS = $Config{ccflags};
-
-if (defined $ENV{CPPFLAGS}) {
- $CCFLAGS .= ' ' . $ENV{CPPFLAGS};
-}
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
@@ -49,7 +43,6 @@ push @writemakefile_args, (
LICENSE => 'gpl_2', # GPL-2.0+, CPAN::Meta::Spec limitation
MIN_PERL_VERSION => '5.8.0',
BUILD_REQUIRES => {},
- CCFLAGS => $CCFLAGS, # e.g -I/usr/include/$ARCH
INC => $INC,
depend => {
Makefile => 'lib/Devel/Mwrap.pm',
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] workaround -DNDEBUG warnings
2019-11-02 10:40 [PATCH 0/4] build system fixes Eric Wong
2019-11-02 10:40 ` [PATCH 1/4] Makefile.PL: remove CCFLAGS overrides Eric Wong
@ 2019-11-02 10:40 ` Eric Wong
2019-11-02 10:40 ` [PATCH 3/4] quiet uninitialized variable warnings Eric Wong
2019-11-02 10:40 ` [PATCH 4/4] avoid mixing declarations and code Eric Wong
3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2019-11-02 10:40 UTC (permalink / raw)
To: mwrap-perl; +Cc: Eric Wong
From: Eric Wong <e@80x24.org>
Perl defaults to building with -DNDEBUG, which causes unused
variable warnings to show up when we use -Wall in CCFLAGS.
---
Mwrap.xs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Mwrap.xs b/Mwrap.xs
index b81dfc0..8ce7b46 100644
--- a/Mwrap.xs
+++ b/Mwrap.xs
@@ -133,6 +133,9 @@ mutex_lock(pthread_mutex_t *m)
{
int err = pthread_mutex_lock(m);
assert(err == 0);
+#ifdef NDEBUG
+ (void)err; /* quiet gcc warning */
+#endif
}
static void
@@ -140,6 +143,9 @@ mutex_unlock(pthread_mutex_t *m)
{
int err = pthread_mutex_unlock(m);
assert(err == 0);
+#ifdef NDEBUG
+ (void)err; /* quiet gcc warning */
+#endif
}
#ifndef HAVE_MEMPCPY
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] quiet uninitialized variable warnings
2019-11-02 10:40 [PATCH 0/4] build system fixes Eric Wong
2019-11-02 10:40 ` [PATCH 1/4] Makefile.PL: remove CCFLAGS overrides Eric Wong
2019-11-02 10:40 ` [PATCH 2/4] workaround -DNDEBUG warnings Eric Wong
@ 2019-11-02 10:40 ` Eric Wong
2019-11-02 10:40 ` [PATCH 4/4] avoid mixing declarations and code Eric Wong
3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2019-11-02 10:40 UTC (permalink / raw)
To: mwrap-perl; +Cc: Eric Wong
From: Eric Wong <e@80x24.org>
-Wmaybe-uninitialized (tested gcc 8.3.0) needlessly warns about
this, but it's a good simplification nevertheless.
---
Mwrap.xs | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/Mwrap.xs b/Mwrap.xs
index 8ce7b46..4d346ab 100644
--- a/Mwrap.xs
+++ b/Mwrap.xs
@@ -469,16 +469,14 @@ internal_memalign(void **pp, size_t alignment, size_t size, uintptr_t caller)
static void *
memalign_result(int err, void *p)
{
- if (caa_unlikely(err)) {
+ if (caa_unlikely(err))
errno = err;
- return 0;
- }
return p;
}
void *memalign(size_t alignment, size_t size)
{
- void *p;
+ void *p = NULL;
int err = internal_memalign(&p, alignment, size, RETURN_ADDRESS(0));
return memalign_result(err, p);
}
@@ -493,7 +491,7 @@ void cfree(void *) __attribute__((alias("free")));
void *valloc(size_t size)
{
- void *p;
+ void *p = NULL;
int err = internal_memalign(&p, page_size, size, RETURN_ADDRESS(0));
return memalign_result(err, p);
}
@@ -511,7 +509,7 @@ void *valloc(size_t size)
void *pvalloc(size_t size)
{
size_t alignment = page_size;
- void *p;
+ void *p = NULL;
int err;
if (add_overflow_p(size, alignment)) {
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] avoid mixing declarations and code
2019-11-02 10:40 [PATCH 0/4] build system fixes Eric Wong
` (2 preceding siblings ...)
2019-11-02 10:40 ` [PATCH 3/4] quiet uninitialized variable warnings Eric Wong
@ 2019-11-02 10:40 ` Eric Wong
3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2019-11-02 10:40 UTC (permalink / raw)
To: mwrap-perl; +Cc: Eric Wong
From: Eric Wong <e@80x24.org>
This quiets warnings when using -Wdeclaration-after-statement
which is still common in some circles.
---
Mwrap.xs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Mwrap.xs b/Mwrap.xs
index 4d346ab..09d5581 100644
--- a/Mwrap.xs
+++ b/Mwrap.xs
@@ -851,8 +851,8 @@ PREINIT:
struct cds_lfht_node *cur;
struct cds_lfht *t;
struct src_loc *l = NULL;
- ++locating;
CODE:
+ ++locating;
if (!SvPOK(loc))
XSRETURN_UNDEF;
str = SvPV(loc, len);
@@ -897,8 +897,8 @@ size_t
src_loc_frees(self)
Devel::Mwrap::SrcLoc self
PREINIT:
- ++locating;
CODE:
+ ++locating;
RETVAL = uatomic_read(&self->frees);
OUTPUT:
RETVAL
@@ -909,8 +909,8 @@ size_t
src_loc_allocations(self)
Devel::Mwrap::SrcLoc self
PREINIT:
- ++locating;
CODE:
+ ++locating;
RETVAL = uatomic_read(&self->allocations);
OUTPUT:
RETVAL
@@ -921,8 +921,8 @@ size_t
src_loc_total(self)
Devel::Mwrap::SrcLoc self
PREINIT:
- ++locating;
CODE:
+ ++locating;
RETVAL = uatomic_read(&self->total);
OUTPUT:
RETVAL
@@ -933,8 +933,8 @@ SV *
src_loc_name(self)
Devel::Mwrap::SrcLoc self
PREINIT:
- ++locating;
CODE:
+ ++locating;
RETVAL = location_string(self);
OUTPUT:
RETVAL
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-11-02 10:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-02 10:40 [PATCH 0/4] build system fixes Eric Wong
2019-11-02 10:40 ` [PATCH 1/4] Makefile.PL: remove CCFLAGS overrides Eric Wong
2019-11-02 10:40 ` [PATCH 2/4] workaround -DNDEBUG warnings Eric Wong
2019-11-02 10:40 ` [PATCH 3/4] quiet uninitialized variable warnings Eric Wong
2019-11-02 10:40 ` [PATCH 4/4] avoid mixing declarations and code Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/mwrap-perl.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).