mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
Except where noted otherwise below most of these warnings relate to implicit conversions between 64- and 32-bit integers or the signedness of integers differing in spots. library/construct.m: Delete an unused local variable in the implementation of get_functor_lex. library/bitmap.m: The function MR_bitmap_cmp returns an MR_Integer not an int. library/thread.semaphore.m: Change the count field of the ML_SEMAPHORE_STRUCT structure into an MR_Integer (which is what gets passed in). trace/mercury_trace_declarative.c: Avoid a warning about fprintf being called where its second argument is not a string literal. (In this case it can be replaced by a call to fputs.) library/io.m: mdbcomp/rtti_access.m: trace/mercury_trace.c: trace/mercury_trace_cmd_breakpoint.c: trace/mercury_trace_cmd_help.c: trace/mercury_trace_completion.m: trace/mercury_trace_declarative.[ch]: trace/mercury_trace_external.c: trace/mercury_trace_internal.c: trace/mercury_trace_source.c: trace/mercury_trace_tables.c: trace/mercury_trace_vars.c: util/info_to_mdb.c: util/mfiltercc.c: util/mdemangle.c: util/mkinit.c: util/mkinit_erl.c: util/mkinit_common.h: util/mkinit_common.c: As above.
79 lines
1.7 KiB
C
79 lines
1.7 KiB
C
/*
|
|
** vim: ft=c ts=4 sw=4 et
|
|
*/
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
/*
|
|
** Copyright (C) 2010, 2012 The University of Melbourne.
|
|
** This file may only be copied under the terms of the GNU General
|
|
** Public License - see the file COPYING in the Mercury distribution.
|
|
*/
|
|
|
|
/*
|
|
** File: mfiltercc.c
|
|
** Author: wangp.
|
|
**
|
|
** This is a last ditch effort to filter out warning messages from the
|
|
** C compiler that we cannot (yet) figure out how to silence in a better way.
|
|
**
|
|
** This program must *not* #include any of the header files in the runtime
|
|
** directory.
|
|
**
|
|
*/
|
|
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
#define MAX_LINE_LENGTH 2000
|
|
|
|
static int drop_line(const char *line);
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
char buf[MAX_LINE_LENGTH];
|
|
size_t len;
|
|
int c;
|
|
|
|
do {
|
|
len = 0;
|
|
c = getchar();
|
|
while (c != EOF) {
|
|
buf[len++] = (char) c;
|
|
if (c == '\n' || len >= sizeof(buf) - 1) {
|
|
break;
|
|
}
|
|
c = getchar();
|
|
}
|
|
|
|
if (len > 0) {
|
|
buf[len] = '\0';
|
|
if (!drop_line(buf)) {
|
|
printf("%s", buf);
|
|
}
|
|
}
|
|
} while (c != EOF);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int
|
|
drop_line(const char *line)
|
|
{
|
|
/*
|
|
** gcc 4.x produces the message (in English locales, with varying quotes):
|
|
** foo.c:42: warning: 'mercury__foo__...' used but never defined
|
|
**
|
|
** gcc 4.6 onwards also add " [enabled by default]"
|
|
*/
|
|
const char *p;
|
|
|
|
p = strstr(line, "mercury__");
|
|
if (p == NULL) {
|
|
return 0;
|
|
}
|
|
return strstr(p, " used but never defined") != NULL;
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|