From a8d30b7ef3af6af8ed635db0ba0d6197c278cac7 Mon Sep 17 00:00:00 2001 From: MLopez-Ibanez <2620021+MLopez-Ibanez@users.noreply.github.com> Date: Mon, 19 Aug 2024 09:05:30 +0100 Subject: [PATCH] Fix Clang warnings --- .github/workflows/R-CMD-check.yaml | 2 +- DESCRIPTION | 4 +-- NEWS.md | 4 ++- R/eafplot.R | 46 +++++++++++++++--------------- cleanup | 8 +++++- man/eafdiffplot.Rd | 2 +- man/eafplot.Rd | 10 +++---- src/Makevars.in | 14 +-------- src/Makevars.win | 16 +---------- src/eaf/eaf_main.c | 12 ++++---- src/eaf/svn_version | 2 +- src/install.libs.R | 19 ++++-------- 12 files changed, 57 insertions(+), 82 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 7b5bc7a..d1cf329 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -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 diff --git a/DESCRIPTION b/DESCRIPTION index a28d554..4237ff6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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")), @@ -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 diff --git a/NEWS.md b/NEWS.md index 234f882..7a29863 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,6 @@ -# eaf (development version) +# eaf 2.5.1 + + * Fix Clang warning. # eaf 2.5 diff --git a/R/eafplot.R b/R/eafplot.R index 219ed3f..395d7a3 100644 --- a/R/eafplot.R +++ b/R/eafplot.R @@ -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. @@ -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) @@ -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") { @@ -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) } @@ -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, @@ -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")) ## } @@ -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] @@ -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)) { @@ -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()]. @@ -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 diff --git a/cleanup b/cleanup index fef1474..9432b46 100755 --- a/cleanup +++ b/cleanup @@ -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 diff --git a/man/eafdiffplot.Rd b/man/eafdiffplot.Rd index 9e85eb5..2caee63 100644 --- a/man/eafdiffplot.Rd +++ b/man/eafdiffplot.Rd @@ -162,6 +162,6 @@ DIFF$right[,3] <- -DIFF$right[,3] } \seealso{ -\code{\link[=read_datasets]{read_datasets()}} \code{\link[=eafplot]{eafplot()}} \code{\link[=pdf_crop]{pdf_crop()}} +\code{\link[=eafplot]{eafplot()}} \code{\link[=pdf_crop]{pdf_crop()}} } \concept{visualisation} diff --git a/man/eafplot.Rd b/man/eafplot.Rd index 7928768..36a0e2f 100644 --- a/man/eafplot.Rd +++ b/man/eafplot.Rd @@ -88,11 +88,11 @@ maximised instead of minimised. Either a single logical value that applies to all objectives or a vector of logical values, with one value per objective.} -\item{xaxis.side}{On which side that xaxis is drawn. Valid values are -"below" and "above". See \code{\link[=axis]{axis()}}.} +\item{xaxis.side}{On which side that x-axis is drawn. Valid values are +\code{"below"} and \code{"above"}. See \code{\link[=axis]{axis()}}.} -\item{yaxis.side}{On which side that yaxis is drawn. Valid values are "left" -and "right". See \code{\link[=axis]{axis()}}.} +\item{yaxis.side}{On which side that y-axis is drawn. Valid values are \code{"left"} +and \code{"right"}. See \code{\link[=axis]{axis()}}.} \item{axes}{A logical value indicating whether both axes should be drawn on the plot.} @@ -187,6 +187,6 @@ eafplot (SPEA2minstoptimeRichmond, xlab = expression(C[E]), } } \seealso{ -\code{\link[=read_datasets]{read_datasets()}} \code{\link[=eafdiffplot]{eafdiffplot()}} \code{\link[=pdf_crop]{pdf_crop()}} +\code{\link[=eafdiffplot]{eafdiffplot()}} \code{\link[=pdf_crop]{pdf_crop()}} } \concept{visualisation} diff --git a/src/Makevars.in b/src/Makevars.in index d331530..fe85bc9 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -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 diff --git a/src/Makevars.win b/src/Makevars.win index 37941e4..9d5a225 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -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 diff --git a/src/eaf/eaf_main.c b/src/eaf/eaf_main.c index 2322893..d1230b1 100644 --- a/src/eaf/eaf_main.c +++ b/src/eaf/eaf_main.c @@ -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 \n" diff --git a/src/eaf/svn_version b/src/eaf/svn_version index 6eac4a6..40cd2b7 100644 --- a/src/eaf/svn_version +++ b/src/eaf/svn_version @@ -1 +1 @@ -292 \ No newline at end of file +292M \ No newline at end of file diff --git a/src/install.libs.R b/src/install.libs.R index 69f09b0..a0b4680 100644 --- a/src/install.libs.R +++ b/src/install.libs.R @@ -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) -}