Remove defs.hpp.

Because we now own the 'tools' subdirectory in the tree, we can yank some
of the upstream autoconf-related complexity.  Start doing so by removing
defs.hpp and using the real compiler attributes where necessary.
This commit is contained in:
jmmv 2014-02-11 16:31:38 +00:00
parent 0ed5fe36b2
commit ad23a81712
15 changed files with 45 additions and 105 deletions

View File

@ -43,7 +43,6 @@ extern "C" {
#include <iostream>
#include "application.hpp"
#include "defs.hpp"
#include "ui.hpp"
#if !defined(HAVE_VSNPRINTF_IN_STD)
@ -148,8 +147,8 @@ impl::app::specific_options(void)
}
void
impl::app::process_option(int ch ATF_DEFS_ATTRIBUTE_UNUSED,
const char* arg ATF_DEFS_ATTRIBUTE_UNUSED)
impl::app::process_option(int ch __attribute__((__unused__)),
const char* arg __attribute__((__unused__)))
{
}

View File

@ -34,7 +34,6 @@
#include "application.hpp"
#include "config.hpp"
#include "defs.hpp"
class atf_config : public tools::application::app {
static const char* m_description;
@ -66,7 +65,7 @@ atf_config::atf_config(void) :
}
void
atf_config::process_option(int ch, const char* arg ATF_DEFS_ATTRIBUTE_UNUSED)
atf_config::process_option(int ch, const char* arg __attribute__((__unused__)))
{
switch (ch) {
case 't':

View File

@ -42,7 +42,6 @@ extern "C" {
#include <vector>
#include "application.hpp"
#include "defs.hpp"
#include "fs.hpp"
#include "reader.hpp"
#include "text.hpp"
@ -133,7 +132,7 @@ public:
virtual
void
write_tp_start(const std::string& name,
size_t ntcs ATF_DEFS_ATTRIBUTE_UNUSED)
size_t ntcs __attribute__((__unused__)))
{
m_tpname = name;
m_failed = false;
@ -420,7 +419,7 @@ class xml_writer : public writer {
void
write_tp_start(const std::string& tp,
size_t ntcs ATF_DEFS_ATTRIBUTE_UNUSED)
size_t ntcs __attribute__((__unused__)))
{
(*m_os) << "<tp id=\"" << attrval(tp) << "\">\n";
}

View File

@ -32,7 +32,6 @@
#include <fstream>
#include "atffile.hpp"
#include "defs.hpp"
#include "exceptions.hpp"
#include "expand.hpp"
#include "parser.hpp"
@ -98,22 +97,22 @@ detail::atf_atffile_reader::~atf_atffile_reader(void)
void
detail::atf_atffile_reader::got_conf(
const std::string& name ATF_DEFS_ATTRIBUTE_UNUSED,
const std::string& val ATF_DEFS_ATTRIBUTE_UNUSED)
const std::string& name __attribute__((__unused__)),
const std::string& val __attribute__((__unused__)))
{
}
void
detail::atf_atffile_reader::got_prop(
const std::string& name ATF_DEFS_ATTRIBUTE_UNUSED,
const std::string& val ATF_DEFS_ATTRIBUTE_UNUSED)
const std::string& name __attribute__((__unused__)),
const std::string& val __attribute__((__unused__)))
{
}
void
detail::atf_atffile_reader::got_tp(
const std::string& name ATF_DEFS_ATTRIBUTE_UNUSED,
bool isglob ATF_DEFS_ATTRIBUTE_UNUSED)
const std::string& name __attribute__((__unused__)),
bool isglob __attribute__((__unused__)))
{
}

View File

@ -36,7 +36,6 @@ extern "C" {
#include <atf-c++.hpp>
#include "auto_array.hpp"
#include "defs.hpp"
// ------------------------------------------------------------------------
// Tests for the "auto_array" class.
@ -55,7 +54,7 @@ public:
return tools::auto_array< test_array >(ta);
}
void* operator new(size_t size ATF_DEFS_ATTRIBUTE_UNUSED)
void* operator new(size_t size __attribute__((__unused__)))
{
ATF_FAIL("New called but should have been new[]");
return new int(5);
@ -69,7 +68,7 @@ public:
return mem;
}
void operator delete(void* mem ATF_DEFS_ATTRIBUTE_UNUSED)
void operator delete(void* mem __attribute__((__unused__)))
{
ATF_FAIL("Delete called but should have been delete[]");
}

View File

@ -33,7 +33,6 @@
#include "config.hpp"
#include "config_file.hpp"
#include "defs.hpp"
#include "env.hpp"
#include "fs.hpp"
#include "parser.hpp"
@ -138,8 +137,8 @@ detail::atf_config_reader::~atf_config_reader(void)
void
detail::atf_config_reader::got_var(
const std::string& var ATF_DEFS_ATTRIBUTE_UNUSED,
const std::string& val ATF_DEFS_ATTRIBUTE_UNUSED)
const std::string& var __attribute__((__unused__)),
const std::string& val __attribute__((__unused__)))
{
}

View File

@ -1,37 +0,0 @@
//
// Automated Testing Framework (atf)
//
// Copyright (c) 2008 The NetBSD Foundation, Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#if !defined(TOOLS_DEFS_HPP)
#define TOOLS_DEFS_HPP
#define ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(a, b) @ATTRIBUTE_FORMAT_PRINTF@
#define ATF_DEFS_ATTRIBUTE_NORETURN @ATTRIBUTE_NORETURN@
#define ATF_DEFS_ATTRIBUTE_UNUSED @ATTRIBUTE_UNUSED@
#endif /* !defined(TOOLS_DEFS_HPP) */

View File

@ -41,7 +41,6 @@ extern "C" {
#include <cstring>
#include <iostream>
#include "defs.hpp"
#include "exceptions.hpp"
#include "text.hpp"
#include "process.hpp"
@ -274,7 +273,7 @@ impl::stream_connect::connect_parent(void)
}
void
impl::stream_connect::connect_child(const int fd ATF_DEFS_ATTRIBUTE_UNUSED)
impl::stream_connect::connect_child(const int fd __attribute__((__unused__)))
{
safe_dup(m_tgt_fd, m_src_fd);
}
@ -295,7 +294,7 @@ impl::stream_inherit::connect_parent(void)
}
void
impl::stream_inherit::connect_child(const int fd ATF_DEFS_ATTRIBUTE_UNUSED)
impl::stream_inherit::connect_child(const int fd __attribute__((__unused__)))
{
}

View File

@ -37,7 +37,6 @@ extern "C" {
#include <sstream>
#include <utility>
#include "defs.hpp"
#include "parser.hpp"
#include "reader.hpp"
#include "text.hpp"
@ -150,53 +149,53 @@ impl::atf_tps_reader::~atf_tps_reader(void)
void
impl::atf_tps_reader::got_info(
const std::string& what ATF_DEFS_ATTRIBUTE_UNUSED,
const std::string& val ATF_DEFS_ATTRIBUTE_UNUSED)
const std::string& what __attribute__((__unused__)),
const std::string& val __attribute__((__unused__)))
{
}
void
impl::atf_tps_reader::got_ntps(size_t ntps ATF_DEFS_ATTRIBUTE_UNUSED)
impl::atf_tps_reader::got_ntps(size_t ntps __attribute__((__unused__)))
{
}
void
impl::atf_tps_reader::got_tp_start(
const std::string& tp ATF_DEFS_ATTRIBUTE_UNUSED,
size_t ntcs ATF_DEFS_ATTRIBUTE_UNUSED)
const std::string& tp __attribute__((__unused__)),
size_t ntcs __attribute__((__unused__)))
{
}
void
impl::atf_tps_reader::got_tp_end(
struct timeval* tv ATF_DEFS_ATTRIBUTE_UNUSED,
const std::string& reason ATF_DEFS_ATTRIBUTE_UNUSED)
struct timeval* tv __attribute__((__unused__)),
const std::string& reason __attribute__((__unused__)))
{
}
void
impl::atf_tps_reader::got_tc_start(
const std::string& tcname ATF_DEFS_ATTRIBUTE_UNUSED)
const std::string& tcname __attribute__((__unused__)))
{
}
void
impl::atf_tps_reader::got_tc_stdout_line(
const std::string& line ATF_DEFS_ATTRIBUTE_UNUSED)
const std::string& line __attribute__((__unused__)))
{
}
void
impl::atf_tps_reader::got_tc_stderr_line(
const std::string& line ATF_DEFS_ATTRIBUTE_UNUSED)
const std::string& line __attribute__((__unused__)))
{
}
void
impl::atf_tps_reader::got_tc_end(
const std::string& state ATF_DEFS_ATTRIBUTE_UNUSED,
struct timeval* tv ATF_DEFS_ATTRIBUTE_UNUSED,
const std::string& reason ATF_DEFS_ATTRIBUTE_UNUSED)
const std::string& state __attribute__((__unused__)),
struct timeval* tv __attribute__((__unused__)),
const std::string& reason __attribute__((__unused__)))
{
}

View File

@ -63,7 +63,7 @@ class tps_reader : protected impl::atf_tps_reader {
}
void
got_tp_end(struct timeval* tv ATF_DEFS_ATTRIBUTE_UNUSED,
got_tp_end(struct timeval* tv __attribute__((__unused__)),
const std::string& reason)
{
m_calls.push_back("got_tp_end(" + reason + ")");
@ -77,7 +77,7 @@ class tps_reader : protected impl::atf_tps_reader {
void
got_tc_end(const std::string& state,
struct timeval* tv ATF_DEFS_ATTRIBUTE_UNUSED,
struct timeval* tv __attribute__((__unused__)),
const std::string& reason)
{
const std::string r = state + (reason.empty() ? "" : ", " + reason);

View File

@ -39,7 +39,6 @@ extern "C" {
#include <stdexcept>
#include "config.hpp"
#include "defs.hpp"
#include "env.hpp"
#include "fs.hpp"
#include "requirements.hpp"
@ -192,7 +191,7 @@ check_memory_netbsd(const int64_t needed)
#else
static
std::string
check_memory_unknown(const int64_t needed ATF_DEFS_ATTRIBUTE_UNUSED)
check_memory_unknown(const int64_t needed __attribute__((__unused__)))
{
return "";
}

View File

@ -39,7 +39,6 @@ extern "C" {
#include <atf-c++.hpp>
#include "defs.hpp"
#include "exceptions.hpp"
#include "process.hpp"
#include "signals.hpp"
@ -53,7 +52,7 @@ namespace sigusr1 {
static
void
handler(int signo ATF_DEFS_ATTRIBUTE_UNUSED)
handler(int signo __attribute__((__unused__)))
{
happened = true;
}
@ -77,7 +76,7 @@ namespace sigusr1_2 {
static
void
handler(int signo ATF_DEFS_ATTRIBUTE_UNUSED)
handler(int signo __attribute__((__unused__)))
{
happened = true;
}
@ -223,7 +222,7 @@ ATF_TEST_CASE_BODY(signal_programmer_preserve)
static
void
reset_child(void *v ATF_DEFS_ATTRIBUTE_UNUSED)
reset_child(void *v __attribute__((__unused__)))
{
sigusr1::program();

View File

@ -45,7 +45,6 @@ extern "C" {
#include <iostream>
#include "config_file.hpp"
#include "defs.hpp"
#include "env.hpp"
#include "fs.hpp"
#include "io.hpp"
@ -417,8 +416,8 @@ detail::atf_tp_reader::~atf_tp_reader(void)
void
detail::atf_tp_reader::got_tc(
const std::string& ident ATF_DEFS_ATTRIBUTE_UNUSED,
const std::map< std::string, std::string >& md ATF_DEFS_ATTRIBUTE_UNUSED)
const std::string& ident __attribute__((__unused__)),
const std::map< std::string, std::string >& md __attribute__((__unused__)))
{
}
@ -695,7 +694,7 @@ namespace {
static volatile bool terminate_poll;
static void
sigchld_handler(const int signo ATF_DEFS_ATTRIBUTE_UNUSED)
sigchld_handler(const int signo __attribute__((__unused__)))
{
terminate_poll = true;
}

View File

@ -40,7 +40,6 @@ extern "C" {
#include <csignal>
#include <ctime>
#include "defs.hpp"
#include "exceptions.hpp"
#include "signals.hpp"
#include "timers.hpp"
@ -59,8 +58,8 @@ static impl::timer* compat_handle;
#if defined(HAVE_TIMER_T)
static
void
handler(const int signo ATF_DEFS_ATTRIBUTE_UNUSED, siginfo_t* si,
void* uc ATF_DEFS_ATTRIBUTE_UNUSED)
handler(const int signo __attribute__((__unused__)), siginfo_t* si,
void* uc __attribute__((__unused__)))
{
impl::timer* timer = static_cast< impl::timer* >(si->si_value.sival_ptr);
timer->set_fired();
@ -69,9 +68,9 @@ handler(const int signo ATF_DEFS_ATTRIBUTE_UNUSED, siginfo_t* si,
#else
static
void
handler(const int signo ATF_DEFS_ATTRIBUTE_UNUSED,
siginfo_t* si ATF_DEFS_ATTRIBUTE_UNUSED,
void* uc ATF_DEFS_ATTRIBUTE_UNUSED)
handler(const int signo __attribute__((__unused__)),
siginfo_t* si __attribute__((__unused__)),
void* uc __attribute__((__unused__)))
{
compat_handle->set_fired();
compat_handle->timeout_callback();

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.2 2014/02/11 16:11:28 jmmv Exp $
# $NetBSD: Makefile,v 1.3 2014/02/11 16:31:38 jmmv Exp $
NOLINT= # defined
@ -56,15 +56,4 @@ SRCS= application.cpp \
ui.cpp \
user.cpp
CLEANFILES+= defs.hpp
beforedepend: defs.hpp
defs.hpp: defs.hpp.in
${TOOL_SED} \
-e 's|@ATTRIBUTE_FORMAT_PRINTF@|__attribute__((__format__(__printf__, a, b)))|g' \
-e 's|@ATTRIBUTE_NORETURN@|__attribute__((__noreturn__))|g' \
-e 's|@ATTRIBUTE_UNUSED@|__attribute__((__unused__))|g' \
<${.ALLSRC} >${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}
.include <bsd.lib.mk>