Never mind, let's drop unused/vestigial altogether. Use absence of names
to signal unused arguments.
This commit is contained in:
Kartik Agaram 2018-07-25 20:47:41 -07:00
parent d671148d99
commit 1a33d221c1
8 changed files with 10 additions and 14 deletions

View File

@ -157,7 +157,7 @@ void initialize_signal_handlers() {
sigaction(SIGABRT, &action, NULL); // assert() failure or integer overflow on linux (with -ftrapv)
sigaction(SIGILL, &action, NULL); // integer overflow on OS X (with -ftrapv)
}
void dump_and_exit(int sig, vestigial siginfo_t*, vestigial void*) {
void dump_and_exit(int sig, siginfo_t* /*unused*/, void* /*unused*/) {
switch (sig) {
case SIGABRT:
#ifndef __APPLE__
@ -256,8 +256,6 @@ using std::cerr;
#include <string>
using std::string;
#define vestigial __attribute__((unused))
#include <algorithm>
using std::min;
using std::max;

View File

@ -202,7 +202,7 @@ bool trace_contains_errors() {
:(before "End Types")
struct end {};
:(code)
ostream& operator<<(ostream& os, vestigial end) {
ostream& operator<<(ostream& os, end /*unused*/) {
if (Trace_stream) Trace_stream->newline();
return os;
}

View File

@ -546,7 +546,7 @@ Transform.push_back(expand_type_abbreviations_in_containers); // idempotent
:(code)
// extremely inefficient; we process all types over and over again, once for every single recipe
// but it doesn't seem to cause any noticeable slowdown
void expand_type_abbreviations_in_containers(vestigial const recipe_ordinal) {
void expand_type_abbreviations_in_containers(const recipe_ordinal /*unused*/) {
for (map<type_ordinal, type_info>::iterator p = Type.begin(); p != Type.end(); ++p) {
for (int i = 0; i < SIZE(p->second.elements); ++i)
expand_type_abbreviations(p->second.elements.at(i).type);

View File

@ -201,7 +201,7 @@ bool contains_type_ingredient_name(const type_tree* type) {
return contains_type_ingredient_name(type->left) || contains_type_ingredient_name(type->right);
}
int number_of_concrete_type_names(vestigial const instruction&, recipe_ordinal r) {
int number_of_concrete_type_names(const instruction& /*unused*/, recipe_ordinal r) {
const recipe& caller = get(Recipe, r);
int result = 0;
for (int i = 0; i < SIZE(caller.ingredients); ++i)
@ -219,7 +219,7 @@ int number_of_concrete_type_names(const type_tree* type) {
+ number_of_concrete_type_names(type->right);
}
int number_of_type_ingredients(vestigial const instruction&, recipe_ordinal r) {
int number_of_type_ingredients(const instruction& /*unused*/, recipe_ordinal r) {
const recipe& caller = get(Recipe, r);
int result = 0;
for (int i = 0; i < SIZE(caller.ingredients); ++i)

View File

@ -311,7 +311,7 @@ def f2 [
+error: f2: divide by zero in '3:num <- divide-with-remainder 4, 0'
-error: f2: divide by zero in '4:num <- divide-with-remainder 4, 0'
:(after "operator<<(ostream& os, vestigial end)")
:(after "operator<<(ostream& os, end /*unused*/)")
if (Trace_stream && Trace_stream->curr_label == "error" && Current_routine) {
Current_routine->state = COMPLETED;
}

View File

@ -158,7 +158,7 @@ void initialize_signal_handlers() {
sigaction(SIGABRT, &action, NULL); // assert() failure or integer overflow on linux (with -ftrapv)
sigaction(SIGILL, &action, NULL); // integer overflow on OS X (with -ftrapv)
}
void dump_and_exit(int sig, vestigial siginfo_t*, vestigial void*) {
void dump_and_exit(int sig, siginfo_t* /*unused*/, void* /*unused*/) {
switch (sig) {
case SIGABRT:
#ifndef __APPLE__
@ -256,8 +256,6 @@ using std::cerr;
#include <string>
using std::string;
#define vestigial __attribute__((unused))
#include <algorithm>
using std::min;
using std::max;

View File

@ -183,7 +183,7 @@ bool trace_contains_errors() {
:(before "End Types")
struct end {};
:(code)
ostream& operator<<(ostream& os, vestigial end) {
ostream& operator<<(ostream& os, end /*unused*/) {
if (Trace_stream) Trace_stream->newline();
return os;
}

View File

@ -119,7 +119,7 @@ inline uint16_t u16_in(uint8_t* p) {
:(before "End Types")
struct perr {};
:(code)
ostream& operator<<(ostream& os, vestigial perr) {
ostream& operator<<(ostream& os, perr /*unused*/) {
if (errno)
os << ": " << strerror(errno);
return os;
@ -128,7 +128,7 @@ ostream& operator<<(ostream& os, vestigial perr) {
:(before "End Types")
struct die {};
:(code)
ostream& operator<<(vestigial ostream&, vestigial die) {
ostream& operator<<(ostream& /*unused*/, die /*unused*/) {
if (Trace_stream) Trace_stream->newline();
exit(1);
}