4235 - fix a build issue for Apple clang 900.0.38

The trouble with rewriting 'unused' to '__attribute__(unused)' is that
if we happen to deliberately introduce '__attribute__(unused)' somehow,
say in the standard headers, then it gets expanded twice to '__attribute__(__attribute__(unused))'.
So we switch to a synonym.
This commit is contained in:
Kartik K. Agaram 2018-04-20 00:06:38 -07:00
parent 8878326574
commit 26a5d50613
5 changed files with 7 additions and 7 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, unused siginfo_t* dummy1, unused void* dummy2) {
void dump_and_exit(int sig, vestigial siginfo_t* dummy1, vestigial void* dummy2) {
switch (sig) {
case SIGABRT:
#ifndef __APPLE__
@ -256,7 +256,7 @@ using std::cerr;
#include <string>
using std::string;
#define unused __attribute__((unused))
#define vestigial __attribute__((unused))
#include <algorithm>
using std::min;

View File

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

View File

@ -761,7 +761,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(unused const recipe_ordinal r) {
void expand_type_abbreviations_in_containers(vestigial const recipe_ordinal r) {
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

@ -205,7 +205,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(unused const instruction& inst, recipe_ordinal r) {
int number_of_concrete_type_names(vestigial const instruction& inst, recipe_ordinal r) {
const recipe& caller = get(Recipe, r);
int result = 0;
for (int i = 0; i < SIZE(caller.ingredients); ++i)
@ -223,7 +223,7 @@ int number_of_concrete_type_names(const type_tree* type) {
+ number_of_concrete_type_names(type->right);
}
int number_of_type_ingredients(unused const instruction& inst, recipe_ordinal r) {
int number_of_type_ingredients(vestigial const instruction& inst, recipe_ordinal r) {
const recipe& caller = get(Recipe, r);
int result = 0;
for (int i = 0; i < SIZE(caller.ingredients); ++i)

View File

@ -312,7 +312,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, unused end)")
:(after "operator<<(ostream& os, vestigial end)")
if (Trace_stream && Trace_stream->curr_label == "error" && Current_routine) {
Current_routine->state = COMPLETED;
}