Skip to content

Commit

Permalink
Fix Clang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MLopez-Ibanez committed Aug 19, 2024
1 parent a4aa39e commit a8d30b7
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
uses: actions/upload-artifact@mv4
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: eaf
Type: Package
Title: Plots of the Empirical Attainment Function
Version: 2.5.0.9000
Version: 2.5.1
Authors@R: c(person("Manuel", "López-Ibáñez", role = c("aut", "cre"),
email = "manuel.lopez-ibanez@manchester.ac.uk",
comment = c(ORCID = "0000-0001-9974-1295")),
Expand Down Expand Up @@ -30,7 +30,7 @@ URL: https://mlopez-ibanez.github.io/eaf/, https://github.com/MLopez-Ibanez/eaf
LazyLoad: true
LazyData: true
Encoding: UTF-8
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Roxygen: list(markdown = TRUE)
SystemRequirements: GNU make, Gnu Scientific Library
RdMacros: Rdpack
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# eaf (development version)
# eaf 2.5.1

* Fix Clang warning.

# eaf 2.5

Expand Down
46 changes: 23 additions & 23 deletions R/eafplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ eafplot <- function(x, ...) UseMethod("eafplot")
#'
#' @template arg_maximise
#'
#' @param xaxis.side On which side that xaxis is drawn. Valid values are
#' "below" and "above". See [axis()].
#' @param xaxis.side On which side that x-axis is drawn. Valid values are
#' `"below"` and `"above"`. See [axis()].
#'
#' @param yaxis.side On which side that yaxis is drawn. Valid values are "left"
#' and "right". See [axis()].
#' @param yaxis.side On which side that y-axis is drawn. Valid values are `"left"`
#' and `"right"`. See [axis()].
#'
#' @param axes A logical value indicating whether both axes should be drawn
#' on the plot.
Expand All @@ -70,7 +70,7 @@ eafplot <- function(x, ...) UseMethod("eafplot")
#'
#' @return Return (invisibly) the attainment surfaces computed.
#'
#' @seealso [read_datasets()] [eafdiffplot()] [pdf_crop()]
#' @seealso [eafdiffplot()] [pdf_crop()]
#'
#'@examples
#' data(gcp2x2)
Expand Down Expand Up @@ -157,8 +157,8 @@ eafplot.default <-
{
type <- match.arg (type, c("point", "area"))
maximise <- as.logical(maximise)
xaxis.side <- match.arg(xaxis.side, c("below", "above"))
yaxis.side <- match.arg(yaxis.side, c("left", "right"))
xaxis_side <- match.arg(xaxis.side, c("below", "above"))
yaxis_side <- match.arg(yaxis.side, c("left", "right"))

if (is.null(col)) {
if (type == "point") {
Expand Down Expand Up @@ -241,8 +241,8 @@ eafplot.default <-
xlim = xlim, ylim = ylim, log = log, axes = FALSE, las = las,
panel.first = ({
if (axes) {
plot_eaf_axis(xaxis.side, xlab, las = las, sci.notation = sci.notation)
plot_eaf_axis(yaxis.side, ylab, las = las, sci.notation = sci.notation,
plot_eaf_axis(xaxis_side, xlab, las = las, sci.notation = sci.notation)
plot_eaf_axis(yaxis_side, ylab, las = las, sci.notation = sci.notation,
# FIXME: eafplot uses 2.2, why the difference?
line = 2.75)
}
Expand Down Expand Up @@ -368,11 +368,11 @@ prettySciNotation <- function(x, digits = 1L)
axis_side <- function(side)
{
if (!is.character(side)) return(side)
return(switch(side,
below = 1,
left = 2,
above = 3,
right = 4))
switch(side,
below = 1,
left = 2,
above = 3,
right = 4)
}

plot_eaf_axis <- function(side, lab, las,
Expand All @@ -396,8 +396,8 @@ plot_eaf_axis <- function(side, lab, las,
## ## Now do the minor ticks, at 1/10 of each power of 10 interval
## ##at.minor <- 2:9 * rep(c(10^c(1:max.pow)) / 10, each = length(2:9))
## at.minor <- 1:10 * rep(c(10^c(1:max.pow)) / 10, each = length(1:10))
## axis (yaxis.side, at = at.minor, tcl = -0.25, labels = FALSE, las=las)
## axis (yaxis.side, at = at.minor, labels = FALSE, tck=1,
## axis (yaxis_side, at = at.minor, tcl = -0.25, labels = FALSE, las=las)
## axis (yaxis_side, at = at.minor, labels = FALSE, tck=1,
## col='lightgray', lty='dotted', lwd=par("lwd"))
## }

Expand Down Expand Up @@ -454,8 +454,8 @@ plot_eafdiff_side <- function (eafdiff, attsurfs = list(),
type <- match.arg (type, c("point", "area"))
maximise <- as.logical(maximise)
side <- match.arg (side, c("left", "right"))
xaxis.side <- if (side == "left") "below" else "above"
yaxis.side <- if (side == "left") "left" else "right"
xaxis_side <- if (side == "left") "below" else "above"
yaxis_side <- if (side == "left") "left" else "right"

# For !full.eaf && type == "area", str(eafdiff) is a polygon:
## $ num [, 1:2]
Expand Down Expand Up @@ -497,8 +497,8 @@ plot_eafdiff_side <- function (eafdiff, attsurfs = list(),
plot(xlim, ylim, type = "n", xlab = "", ylab = "",
xlim = xlim, ylim = ylim, log = log, axes = FALSE, las = las,
panel.first = ({
plot_eaf_axis (xaxis.side, xlab, las = las, sci.notation = sci.notation)
plot_eaf_axis (yaxis.side, ylab, las = las, sci.notation = sci.notation,
plot_eaf_axis (xaxis_side, xlab, las = las, sci.notation = sci.notation)
plot_eaf_axis (yaxis_side, ylab, las = las, sci.notation = sci.notation,
line = 2.2)

if (nrow(eafdiff)) {
Expand Down Expand Up @@ -585,10 +585,10 @@ plot_eafdiff_side <- function (eafdiff, attsurfs = list(),
#' (\samp{points}) or whether to color the areas that have at least a
#' certain value (\samp{area}).
#'
#'@param legend.pos The position of the legend. See [legend()]. A value of
#' @param legend.pos The position of the legend. See [legend()]. A value of
#' `"none"` hides the legend.
#'
#'@param title.left,title.right Title for left and right panels, respectively.
#' @param title.left,title.right Title for left and right panels, respectively.
#'
#' @param xlim,ylim,cex,cex.lab,cex.axis Graphical parameters, see
#' [plot.default()].
Expand Down Expand Up @@ -647,7 +647,7 @@ plot_eafdiff_side <- function (eafdiff, attsurfs = list(),
#'
#' @return Returns a representation of the EAF differences (invisibly).
#'
#' @seealso [read_datasets()] [eafplot()] [pdf_crop()]
#' @seealso [eafplot()] [pdf_crop()]
#'
#' @examples
#' ## NOTE: The plots in the website look squashed because of how pkgdown
Expand Down
8 changes: 7 additions & 1 deletion cleanup
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/sh
rm -f config.* confdefs.h tests/testthat/*.pdf \
src/*.o src/*.so src/Makevars src/config.h src/symbols.rds \
inst/doc/*.blg inst/doc/*.bbl *-Ex.R
inst/doc/*.blg inst/doc/*.bbl *-Ex.R \
src/eaf/eaf \
src/mo-tools/dominatedsets \
src/mo-tools/epsilon \
src/mo-tools/igd \
src/mo-tools/ndsort \
src/mo-tools/nondominated

rm -rf autom4te.cache
2 changes: 1 addition & 1 deletion man/eafdiffplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions man/eafplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 1 addition & 13 deletions src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,12 @@ OBJECTS = $(SOURCES:.c=.o)

export GSL_CFLAGS GSL_LIBS

eaf = eaf/eaf$(EXEEXT)
igd = mo-tools/igd$(EXEEXT)
epsilon = mo-tools/epsilon$(EXEEXT)
dominatedsets = mo-tools/dominatedsets$(EXEEXT)
nondominated = mo-tools/nondominated$(EXEEXT)
ndsort = mo-tools/ndsort$(EXEEXT)

.PHONY: all clean

all: $(SHLIB)
$(MAKE) -C eaf all march=none CC="$(CC)" CFLAGS="$(CFLAGS) $(LTO)" OPT_CFLAGS="" WARN_CFLAGS="" DEBUG=$(DEBUG) EXE=$(EXEEXT)
$(MAKE) -C mo-tools all march=none CC="$(CC)" CFLAGS="$(CFLAGS) $(LTO)" OPT_CFLAGS="" WARN_CFLAGS="" DEBUG=$(DEBUG) EXE=$(EXEEXT)

$(SHLIB): $(OBJECTS)

clean:
@-rm -f *.o *.so *.dll \
eaf/*.o $(eaf) \
$(igd) $(epsilon) $(dominatedsets) $(nondominated) $(ndsort) \
mo-tools/*.o
@-rm -f *.o *.so *.dll eaf/*.o mo-tools/*.o

16 changes: 1 addition & 15 deletions src/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,16 @@ MOTOOLS_SRC_FILES = hv_contrib.c hv.c pareto.c whv.c whv_hype.c
SOURCES = $(EAF_SRC_FILES:%=eaf/%) $(MOTOOLS_SRC_FILES:%=mo-tools/%) init.c Reaf.c Repsilon.c Rhv.c Rnondominated.c
OBJECTS = $(SOURCES:.c=.o)

EXEEXT=.exe

export GSL_CFLAGS GSL_LIBS

eaf = eaf/eaf$(EXEEXT)
igd = mo-tools/igd$(EXEEXT)
epsilon = mo-tools/epsilon$(EXEEXT)
dominatedsets = mo-tools/dominatedsets$(EXEEXT)
nondominated = mo-tools/nondominated$(EXEEXT)
ndsort = mo-tools/ndsort$(EXEEXT)

.PHONY: all clean winlibs

all: $(SHLIB)
$(MAKE) -C eaf all march=none CC="$(CC)" CFLAGS="$(CFLAGS)" OPT_CFLAGS="" WARN_CFLAGS="" DEBUG=$(DEBUG) EXE=$(EXEEXT)
$(MAKE) -C mo-tools all march=none CC="$(CC)" CFLAGS="$(CFLAGS)" OPT_CFLAGS="" WARN_CFLAGS="" DEBUG=$(DEBUG) EXE=$(EXEEXT)

$(SHLIB): $(OBJECTS)

clean:
@-rm -f *.o *.so *.dll \
eaf/*.o $(eaf) \
$(igd) $(epsilon) $(dominatedsets) $(nondominated) $(ndsort) \
mo-tools/*.o
@-rm -f *.o *.so *.dll eaf/*.o mo-tools/*.o

$(OBJECTS): winlibs

Expand Down
12 changes: 7 additions & 5 deletions src/eaf/eaf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ static void usage(void)

static void version(void)
{
printf("%s version %s"
#ifdef MARCH
" (optimised for "MARCH")"
#endif
#ifndef VERSION
#define VERSION "unknown"
#endif
"\n\n", program_invocation_short_name, VERSION);
#ifdef MARCH
#define OPTIMISED_FOR_STR " (optimised for "MARCH")"
#else
#define OPTIMISED_FOR_STR ""
#endif
printf("%s version " VERSION OPTIMISED_FOR_STR
"\n\n", program_invocation_short_name);
printf(
"Copyright (C) 2009\n"
"Carlos Fonseca <cmfonsec@ualg.pt>\n"
Expand Down
2 changes: 1 addition & 1 deletion src/eaf/svn_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
292
292M
19 changes: 5 additions & 14 deletions src/install.libs.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
execs <- c(file.path("eaf", "eaf"),
file.path("mo-tools", c("epsilon","igd","dominatedsets","nondominated","ndsort")))

if (WINDOWS) execs <- paste0(execs, ".exe")
if (any(file.exists(execs))) {
dest <- file.path(R_PACKAGE_DIR, paste0('bin', R_ARCH))
files <- Sys.glob(paste0("*", SHLIB_EXT))
if (any(file.exists(files))) {
dest <- file.path(R_PACKAGE_DIR, paste0('libs', R_ARCH))
dir.create(dest, recursive = TRUE, showWarnings = FALSE)
file.copy(execs, dest, overwrite = TRUE)
file.copy(files, dest, overwrite = TRUE)
}

files <- Sys.glob(paste0("*", SHLIB_EXT))
dest <- file.path(R_PACKAGE_DIR, paste0('libs', R_ARCH))
dir.create(dest, recursive = TRUE, showWarnings = FALSE)
file.copy(files, dest, overwrite = TRUE)
if (file.exists("symbols.rds")) {
if (file.exists("symbols.rds"))
file.copy("symbols.rds", dest, overwrite = TRUE)
}

0 comments on commit a8d30b7

Please sign in to comment.