Ejemplo n.º 1
0
/**
 * parse_option - Convert result of string comparisons into numerics.
 * @input: Pointer to the word
 *
 * This function is called by config_vifs_from_file().
 *
 * Returns:
 * A number corresponding to the code of the word, or %CONF_UNKNOWN.
 */
static int parse_option(char *word)
{
    if (EQUAL(word, ""))
	return CONF_EMPTY;
    if (EQUAL(word, "phyint"))
	return CONF_PHYINT;
    if (EQUAL(word, "cand_rp"))
	return CONF_CANDIDATE_RP;
    if (EQUAL(word, "rp_address"))
	return CONF_RP_ADDRESS;
    if (EQUAL(word, "group_prefix"))
	return CONF_GROUP_PREFIX;
    if (EQUAL(word, "cand_bootstrap_router"))
	return CONF_BOOTSTRAP_RP;
    if (EQUAL(word, "switch_register_threshold"))
	return deprecated(word, "spt_threshold", CONF_COMPAT_THRESHOLD);
    if (EQUAL(word, "switch_data_threshold"))
	return deprecated(word, "spt_threshold", CONF_COMPAT_THRESHOLD);
    if (EQUAL(word, "spt_threshold"))
	return CONF_SPT_THRESHOLD;
    if (EQUAL(word, "default_source_metric"))
	return CONF_DEFAULT_SOURCE_METRIC;
    if (EQUAL(word, "default_source_preference"))
	return CONF_DEFAULT_SOURCE_PREFERENCE;
    if (EQUAL(word, "altnet"))
	return CONF_ALTNET;
    if  (EQUAL(word, "masklen"))
	return CONF_MASKLEN;
    if  (EQUAL(word, "scoped"))
	return CONF_SCOPED;

    return CONF_UNKNOWN;
}
Ejemplo n.º 2
0
void GraphInvalidator::
        test()
{
    // It should invalidate caches and wakeup workers
    {
        // create
        Dag::ptr dag(new Dag);
        Bedroom::ptr bedroom(new Bedroom);
        INotifier::ptr notifier(new BedroomNotifier(bedroom));
        Step::ptr step(new Step(Signal::OperationDesc::ptr()));
        WaitForWakeupMock sleeper(bedroom);

        // wire up
        sleeper.start ();
        dag.write ()->appendStep(step);
        Signal::Intervals initial_valid(-20,60);
        int taskid = Step::registerTask(step.write (), initial_valid.spannedInterval ());
        (void)taskid; // discard
        EXCEPTION_ASSERT_EQUALS(step.read ()->not_started(), ~initial_valid);
        EXCEPTION_ASSERT(sleeper.isRunning ());

        EXCEPTION_ASSERT_EQUALS(sleeper.wait (1), false);
        EXCEPTION_ASSERT_EQUALS(bedroom->sleepers (), 1);

        // test
        GraphInvalidator graphInvalidator(dag, notifier, step);
        Signal::Intervals deprecated(40,50);
        graphInvalidator.deprecateCache (deprecated);

        EXCEPTION_ASSERT_EQUALS(step.read ()->not_started(), ~initial_valid | deprecated);
        sleeper.wait (1);
        EXCEPTION_ASSERT_EQUALS(bedroom->sleepers (), 0);
        EXCEPTION_ASSERT(sleeper.isFinished ());
    }
}
Ejemplo n.º 3
0
void luax_markdeprecated(lua_State *L, const char *name, APIType api, DeprecationType type, const char *replacement)
{
	MarkDeprecated deprecated(name, api, type, replacement);

	if (deprecated.info != nullptr && deprecated.info->uses == 1)
	{
		luaL_where(L, 1);
		const char *where = lua_tostring(L, -1);
		if (where != nullptr)
			deprecated.info->where = where;
		lua_pop(L, 1);
	}
}
Ejemplo n.º 4
0
   char ch = (char)ptr;
   short sh = (short)ptr;
   ch = (char)ptr;
   sh = (short)ptr;
}


typedef struct {
  UNKNOWN u; // expected-error {{unknown type name 'UNKNOWN'}}
} AA;

typedef struct {
  AA; // expected-warning {{anonymous structs are a Microsoft extension}}
} BB;

__declspec(deprecated("This is deprecated")) enum DE1 { one, two } e1; // expected-note {{'e1' declared here}}
struct __declspec(deprecated) DS1 { int i; float f; }; // expected-note {{declared here}}

#define MY_TEXT		"This is also deprecated"
__declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {} // expected-note {{'Dfunc1' declared here}}

struct __declspec(deprecated(123)) DS2 {};	// expected-error {{argument to deprecated attribute was not a string literal}}

void test( void ) {
	e1 = one;	// expected-warning {{'e1' is deprecated: This is deprecated}}
	struct DS1 s = { 0 };	// expected-warning {{'DS1' is deprecated}}
	Dfunc1();	// expected-warning {{'Dfunc1' is deprecated: This is also deprecated}}

	enum DE1 no;	// no warning because E1 is not deprecated
}
/* Test __attribute__ ((deprecated("message"))) */
/* { dg-do compile } */
/* { dg-options "-Wdeprecated-declarations -fmessage-length=0" } */

typedef int INT1 __attribute__((deprecated("Please avoid INT1")));
typedef INT1 INT2 __attribute__ ((__deprecated__("Please avoid INT2")));

typedef INT1 INT1a; 			/* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */

INT1 should_be_unavailable; 		/* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */
INT1a should_not_be_deprecated;

INT1 f1(void) __attribute__ ((deprecated("Please avoid f1"))); 
INT1 f2(void) { return 0; }		/* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */

INT2 f3(void) __attribute__ ((__deprecated__("Please avoid f3"))); 
INT2 f4(void) { return 0; }		/* { dg-warning "'INT2' is deprecated .declared at \[^\n\]*: Please avoid INT2" "" } */
int f5(INT2 x);				/* { dg-warning "'INT2' is deprecated" "" } */
int f6(INT2 x) __attribute__ ((__deprecated__("Please avoid f6")));

typedef enum Color {red, green, blue} Color __attribute__((deprecated("Please avoid Color")));

int g1;
int g2 __attribute__ ((deprecated("Please avoid g2")));
int g3 __attribute__ ((__deprecated__("Please avoid g3")));
Color k;				/* { dg-warning "'Color' is deprecated .declared at \[^\n\]*: Please avoid Color" "" } */

typedef struct {
  int field1;
  int field2 __attribute__ ((deprecated("Please avoid field2")));
  int field3;
Ejemplo n.º 6
0
int __declspec(deprecated("dont use me")) func(void)
{
	return 42;
}
typedef int __declspec(deprecated("old deprecated type")) depr_type;
depr_type __declspec(deprecated) k = 42;

int main(void) {
	return func() - k;
}
Ejemplo n.º 7
0
Archivo: config.c Proyecto: ViToni/pimd
/**
 * parse_option - Convert result of string comparisons into numerics.
 * @input: Pointer to the word
 *
 * This function is called by config_vifs_from_file().
 *
 * Returns:
 * A number corresponding to the code of the word, or %CONF_UNKNOWN.
 */
static int parse_option(char *word)
{
    if (EQUAL(word, ""))
	return CONF_EMPTY;
    if (EQUAL(word, "phyint"))
	return CONF_PHYINT;
    if (EQUAL(word, "bsr-candidate"))
	return CONF_BOOTSTRAP_RP;
    if (EQUAL(word, "rp-candidate"))
	return CONF_CANDIDATE_RP;
    if (EQUAL(word, "rp-address"))
	return CONF_RP_ADDRESS;
    if (EQUAL(word, "group-prefix"))
	return CONF_GROUP_PREFIX;
    if (EQUAL(word, "spt-threshold"))
	return CONF_SPT_THRESHOLD;
    if (EQUAL(word, "default-route-metric"))
	return CONF_DEFAULT_ROUTE_METRIC;
    if (EQUAL(word, "default-route-distance"))
	return CONF_DEFAULT_ROUTE_DISTANCE;
    if (EQUAL(word, "igmp-query-interval"))
	return CONF_IGMP_QUERY_INTERVAL;
    if (EQUAL(word, "igmp-querier-timeout"))
	return CONF_IGMP_QUERIER_TIMEOUT;
    if (EQUAL(word, "altnet"))
	return CONF_ALTNET;
    if  (EQUAL(word, "masklen"))
	return CONF_MASKLEN;
    if  (EQUAL(word, "scoped"))
	return CONF_SCOPED;
    if (EQUAL(word, "hello-interval"))
	return CONF_HELLO_INTERVAL;

    /* Compatibility with old config files that use _ instead of - */
    if (EQUAL(word, "cand_bootstrap_router"))
	return CONF_BOOTSTRAP_RP;
    if (EQUAL(word, "cand_rp"))
	return CONF_CANDIDATE_RP;
    if (EQUAL(word, "group_prefix"))
	return CONF_GROUP_PREFIX;
    if (EQUAL(word, "rp_address"))
	return CONF_RP_ADDRESS;
    if (EQUAL(word, "switch_register_threshold"))
	return deprecated(word, "spt-threshold", CONF_COMPAT_THRESHOLD);
    if (EQUAL(word, "switch_data_threshold"))
	return deprecated(word, "spt-threshold", CONF_COMPAT_THRESHOLD);
    if (EQUAL(word, "spt_threshold"))
	return CONF_SPT_THRESHOLD;
    if (EQUAL(word, "default_source_metric"))
	return CONF_DEFAULT_ROUTE_METRIC;
    if (EQUAL(word, "default_source_preference"))
	return CONF_DEFAULT_ROUTE_DISTANCE;
    if (EQUAL(word, "default_igmp_query_interval"))  /* compat */
	return CONF_IGMP_QUERY_INTERVAL;
    if (EQUAL(word, "default_igmp_querier_timeout")) /* compat */
	return CONF_IGMP_QUERIER_TIMEOUT;
    if (EQUAL(word, "hello_period"))
	return CONF_HELLO_INTERVAL;

    return CONF_UNKNOWN;
}
Ejemplo n.º 8
0
// RUN: %clang_cc1 -std=c++11 -ast-print -fms-extensions %s | FileCheck %s
// FIXME: align attribute print

// CHECK: int x __attribute__((aligned(4, 0)));
int x __attribute__((aligned(4)));

// FIXME: Print this at a valid location for a __declspec attr.
// CHECK: int y __declspec(align(4, 1));
__declspec(align(4)) int y;

// CHECK: gnu::aligned(4, 0)]];
int z [[gnu::aligned(4)]];

// CHECK: __attribute__((deprecated("warning")));
int a __attribute__((deprecated("warning")));

// CHECK: gnu::deprecated("warning")]];
int b [[gnu::deprecated("warning")]];

// CHECK: int cxx11_alignas alignas(4, 0);
alignas(4) int cxx11_alignas;

// CHECK: int c11_alignas _Alignas(alignof(int), 0);
_Alignas(int) int c11_alignas;

// CHECK: void foo() __attribute__((const));
void foo() __attribute__((const));

// CHECK: void bar() __attribute__((__const));
void bar() __attribute__((__const));
Ejemplo n.º 9
0
int printf(const char * restrict, ...) __attribute__((__format__ (__printf__, 1, 2)));
int putc(int, FILE *);
int putchar(int);
int puts(const char *);
int remove(const char *);
int rename (const char *, const char *);
void rewind(FILE *);
int scanf(const char * restrict, ...) __attribute__((__format__ (__scanf__, 1, 2)));
void setbuf(FILE * restrict, char * restrict);
int setvbuf(FILE * restrict, char * restrict, int, size_t);
int sprintf(char * restrict, const char * restrict, ...) __attribute__((__format__ (__printf__, 2, 3)));
int sscanf(const char * restrict, const char * restrict, ...) __attribute__((__format__ (__scanf__, 2, 3)));
FILE *tmpfile(void);


__attribute__((deprecated("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead.")))

char *tmpnam(char *);
int ungetc(int, FILE *);
int vfprintf(FILE * restrict, const char * restrict, va_list) __attribute__((__format__ (__printf__, 2, 0)));
int vprintf(const char * restrict, va_list) __attribute__((__format__ (__printf__, 1, 0)));
int vsprintf(char * restrict, const char * restrict, va_list) __attribute__((__format__ (__printf__, 2, 0)));
# 294 "/usr/include/stdio.h" 3 4
char *ctermid(char *);





FILE *fdopen(int, const char *) __asm("_" "fdopen");
Ejemplo n.º 10
0
char test2[__has_feature(attribute_unavailable_with_message) ? 1 : -1];

// rdar://9623855
void unavail(void)  __attribute__((__unavailable__));
void unavail(void) {
  // No complains inside an unavailable function.
  int ir = foo(1);
  double dr = dfoo(1.0);
  void (*fp)() = &bar;
  double (*fp4)(double) = dfoo;
}

// rdar://10201690
enum foo {
    a = 1,
    b __attribute__((deprecated())) = 2,
    c = 3
}__attribute__((deprecated()));  

enum fee { // expected-note {{declaration has been explicitly marked unavailable here}}
    r = 1, // expected-note {{declaration has been explicitly marked unavailable here}}
    s = 2,
    t = 3
}__attribute__((unavailable()));  

enum fee f() { // expected-error {{'fee' is unavailable}}
    int i = a; // expected-warning {{'a' is deprecated}}

    i = b; // expected-warning {{'b' is deprecated}}

    return r; // expected-error {{'r' is unavailable}}
Ejemplo n.º 11
0
// RUN: %clang_cc1 -std=c++11 -ast-print -fms-extensions %s | FileCheck %s
//
// CHECK: int x __attribute__((aligned(4)));
int x __attribute__((aligned(4)));

// FIXME: Print this at a valid location for a __declspec attr.
// CHECK: int y __declspec(align(4));
__declspec(align(4)) int y;

// CHECK: int z {{\[}}[gnu::aligned(4)]];
int z [[gnu::aligned(4)]];

// CHECK: __attribute__((deprecated("warning")));
int a __attribute__((deprecated("warning")));

// CHECK: int b {{\[}}[gnu::deprecated("warning")]];
int b [[gnu::deprecated("warning")]];

// CHECK: __declspec(deprecated("warning"))
__declspec(deprecated("warning")) int c;

// CHECK: int d {{\[}}[deprecated("warning")]];
int d [[deprecated("warning")]];

// CHECK: __attribute__((deprecated("warning", "fixit")));
int e __attribute__((deprecated("warning", "fixit")));

// CHECK: int cxx11_alignas alignas(4);
alignas(4) int cxx11_alignas;

// CHECK: int c11_alignas _Alignas(alignof(int));
/* Test __attribute__((deprecated)).  Test types without names.  */
/* Origin: Joseph Myers <*****@*****.**> */
/* { dg-do compile } */
/* { dg-options "" } */

struct { int a; } __attribute__((deprecated ("Do not use"))) x; /* { dg-warning "type is deprecated" } */
typeof(x) y; /* { dg-warning "type is deprecated .declared at .*.: Do not use" } */
Ejemplo n.º 13
0
// RUN: %clang_cc1 %s -verify -fsyntax-only
// rdar: // 6734520

typedef int INT1 __attribute__((deprecated("Please avoid INT1")));

typedef INT1 INT2 __attribute__ ((__deprecated__("Please avoid INT2")));

typedef INT1 INT1a; // expected-warning {{'INT1' is deprecated: Please avoid INT1}}

typedef INT1 INT1b __attribute__ ((deprecated("Please avoid INT1b")));

INT1 should_be_unavailable; // expected-warning {{'INT1' is deprecated: Please avoid INT1}}
INT1a should_not_be_deprecated;

INT1 f1(void) __attribute__ ((deprecated("Please avoid f1")));
INT1 f2(void); // expected-warning {{'INT1' is deprecated: Please avoid INT1}}

typedef enum {red, green, blue} Color __attribute__((deprecated("Please avoid Color")));


Color c1; // expected-warning {{'Color' is deprecated: Please avoid Color}}

int g1;
int g2 __attribute__ ((deprecated("Please avoid g2"))); // expected-note {{'g2' declared here}}

int func1()
{
    int (*pf)() = f1; // expected-warning {{'f1' is deprecated: Please avoid f1}}
    int i = f2();
    return g1 + g2; // expected-warning {{'g2' is deprecated: Please avoid g2}}
}
Ejemplo n.º 14
0
bool Configuration::read(const std::vector<std::string> &config_paths, bool ignore_errors)
{
	option_parser p;

	p.add<void>("visualizer_sample_multiplier", nullptr, "", [](std::string v) {
			if (!v.empty())
				deprecated(
					"visualizer_sample_multiplier",
					0.9,
					"visualizer scales automatically");
		});
	p.add<void>("progressbar_boldness", nullptr, "", [](std::string v) {
			if (!v.empty())
				deprecated(
					"progressbar_boldness",
					0.9,
					"use extended progressbar_color and progressbar_elapsed_color instead");
		});

	// keep the same order of variables as in configuration file
	p.add("ncmpcpp_directory", &ncmpcpp_directory, "~/.ncmpcpp/", adjust_directory);
	p.add("lyrics_directory", &lyrics_directory, "~/.lyrics/", adjust_directory);
	p.add<void>("mpd_host", nullptr, "localhost", [](std::string host) {
			expand_home(host);
			Mpd.SetHostname(host);
		});
	p.add<void>("mpd_port", nullptr, "6600", [](std::string port) {
			Mpd.SetPort(verbose_lexical_cast<unsigned>(port));
		});
	p.add("mpd_music_dir", &mpd_music_dir, "~/music", adjust_directory);
	p.add("mpd_connection_timeout", &mpd_connection_timeout, "5");
	p.add("mpd_crossfade_time", &crossfade_time, "5");
	p.add("visualizer_fifo_path", &visualizer_fifo_path, "/tmp/mpd.fifo", adjust_path);
	p.add("visualizer_output_name", &visualizer_output_name, "Visualizer feed");
	p.add("visualizer_in_stereo", &visualizer_in_stereo, "yes", yes_no);
	p.add("visualizer_sync_interval", &visualizer_sync_interval, "30",
	      [](std::string v) {
		      unsigned sync_interval = verbose_lexical_cast<unsigned>(v);
		      lowerBoundCheck<unsigned>(sync_interval, 10);
		      return boost::posix_time::seconds(sync_interval);
	});
	p.add("visualizer_type", &visualizer_type, "wave");
	p.add("visualizer_look", &visualizer_chars, "●▮", [](std::string s) {
			auto result = ToWString(std::move(s));
			boundsCheck<std::wstring::size_type>(result.size(), 2, 2);
			return result;
	});
	p.add("visualizer_color", &visualizer_colors,
	      "blue, cyan, green, yellow, magenta, red", list_of<NC::FormattedColor>);
	p.add("system_encoding", &system_encoding, "", [](std::string encoding) {
#ifdef HAVE_LANGINFO_H
			// try to autodetect system encoding
			if (encoding.empty())
			{
				encoding = nl_langinfo(CODESET);
				if (encoding == "UTF-8") // mpd uses utf-8 by default so no need to convert
					encoding.clear();
			}
#endif // HAVE_LANGINFO_H
			return encoding;
		});
	p.add("playlist_disable_highlight_delay", &playlist_disable_highlight_delay,
	      "5", [](std::string v) {
		      return boost::posix_time::seconds(verbose_lexical_cast<unsigned>(v));
	      });
	p.add("message_delay_time", &message_delay_time, "5");
	p.add("song_list_format", &song_list_format,
	      "{%a - }{%t}|{$8%f$9}$R{$3(%l)$9}", [](std::string v) {
		      return Format::parse(v);
	      });
	p.add("song_status_format", &song_status_format,
	      "{{%a{ \"%b\"{ (%y)}} - }{%t}}|{%f}", [this](std::string v) {
		      auto flags = Format::Flags::All ^ Format::Flags::OutputSwitch;
		      // precompute wide format for status display
		      song_status_wformat = Format::parse(ToWString(v), flags);
		      return Format::parse(v, flags);
	});
	p.add("song_library_format", &song_library_format,
	      "{%n - }{%t}|{%f}", [](std::string v) {
		      return Format::parse(v);
	      });
	p.add("alternative_header_first_line_format", &new_header_first_line,
	      "$b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b", [](std::string v) {
		      return Format::parse(ToWString(std::move(v)),
		                           Format::Flags::All ^ Format::Flags::OutputSwitch);
	});
	p.add("alternative_header_second_line_format", &new_header_second_line,
	      "{{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}", [](std::string v) {
		      return Format::parse(ToWString(std::move(v)),
		                           Format::Flags::All ^ Format::Flags::OutputSwitch);
	});
	p.add("now_playing_prefix", &now_playing_prefix,
	      "$b", [this](std::string v) {
		      NC::Buffer result = buffer(v);
		      now_playing_prefix_length = wideLength(ToWString(result.str()));
		      return result;
	});
	p.add("now_playing_suffix", &now_playing_suffix,
	      "$/b", [this](std::string v) {
		      NC::Buffer result = buffer(v);
		      now_playing_suffix_length = wideLength(ToWString(result.str()));
		      return result;
	});
	p.add("browser_playlist_prefix", &browser_playlist_prefix, "$2playlist$9 ", buffer);
	p.add("selected_item_prefix", &selected_item_prefix,
	      "$6", [this](std::string v) {
		      NC::Buffer result = buffer(v);
		      selected_item_prefix_length = wideLength(ToWString(result.str()));
		      return result;
	      });
	p.add("selected_item_suffix", &selected_item_suffix,
	      "$9", [this](std::string v) {
		      NC::Buffer result = buffer(v);
		      selected_item_suffix_length = wideLength(ToWString(result.str()));
		      return result;
	      });
	p.add("modified_item_prefix", &modified_item_prefix, "$3>$9 ", buffer);
	p.add("song_window_title_format", &song_window_title_format,
	      "{%a - }{%t}|{%f}", [](std::string v) {
		      return Format::parse(v, Format::Flags::Tag);
	      });
	p.add("browser_sort_mode", &browser_sort_mode, "name");
	p.add("browser_sort_format", &browser_sort_format,
	      "{%a - }{%t}|{%f} {(%l)}", [](std::string v) {
		      return Format::parse(v, Format::Flags::Tag);
	      });
	p.add("song_columns_list_format", &song_columns_mode_format,
	      "(20)[]{a} (6f)[green]{NE} (50)[white]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l}",
	      [this](std::string v) {
		      columns = generate_columns(v);
		      return columns_to_format(columns);
	      });
	p.add("execute_on_song_change", &execute_on_song_change, "", adjust_path);
	p.add("execute_on_player_state_change", &execute_on_player_state_change,
	      "", adjust_path);
	p.add("playlist_show_mpd_host", &playlist_show_mpd_host, "no", yes_no);
	p.add("playlist_show_remaining_time", &playlist_show_remaining_time, "no", yes_no);
	p.add("playlist_shorten_total_times", &playlist_shorten_total_times, "no", yes_no);
	p.add("playlist_separate_albums", &playlist_separate_albums, "no", yes_no);
	p.add("playlist_display_mode", &playlist_display_mode, "columns");
	p.add("browser_display_mode", &browser_display_mode, "classic");
	p.add("search_engine_display_mode", &search_engine_display_mode, "classic");
	p.add("playlist_editor_display_mode", &playlist_editor_display_mode, "classic");
	p.add("discard_colors_if_item_is_selected", &discard_colors_if_item_is_selected,
	      "yes", yes_no);
	p.add("show_duplicate_tags", &MPD::Song::ShowDuplicateTags, "yes", yes_no);
	p.add("incremental_seeking", &incremental_seeking, "yes", yes_no);
	p.add("seek_time", &seek_time, "1");
	p.add("volume_change_step", &volume_change_step, "2");
	p.add("autocenter_mode", &autocenter_mode, "no", yes_no);
	p.add("centered_cursor", &centered_cursor, "no", yes_no);
	p.add("progressbar_look", &progressbar, "=>", [](std::string v) {
			auto result = ToWString(std::move(v));
			boundsCheck<std::wstring::size_type>(result.size(), 2, 3);
			// If two characters were specified, fill \0 as the third one.
			result.resize(3);
			return result;
	});
	p.add("default_place_to_search_in", &search_in_db, "database", [](std::string v) {
			if (v == "database")
				return true;
			else if (v == "playlist")
				return false;
			else
				invalid_value(v);
	});
	p.add("user_interface", &design, "classic");
	p.add("data_fetching_delay", &data_fetching_delay, "yes", yes_no);
	p.add("media_library_primary_tag", &media_lib_primary_tag, "artist", [](std::string v) {
			if (v == "artist")
				return MPD_TAG_ARTIST;
			else if (v == "album_artist")
				return MPD_TAG_ALBUM_ARTIST;
			else if (v == "date")
				return MPD_TAG_DATE;
			else if (v == "genre")
				return MPD_TAG_GENRE;
			else if (v == "composer")
				return MPD_TAG_COMPOSER;
			else if (v == "performer")
				return MPD_TAG_PERFORMER;
			else
				invalid_value(v);
		});
	p.add("default_find_mode", &wrapped_search, "wrapped", [](std::string v) {
			if (v == "wrapped")
				return true;
			else if (v == "normal")
				return false;
			else
				invalid_value(v);
		});
	p.add("default_tag_editor_pattern", &pattern, "%n - %t");
	p.add("header_visibility", &header_visibility, "yes", yes_no);
	p.add("statusbar_visibility", &statusbar_visibility, "yes", yes_no);
	p.add("titles_visibility", &titles_visibility, "yes", yes_no);
	p.add("header_text_scrolling", &header_text_scrolling, "yes", yes_no);
	p.add("cyclic_scrolling", &use_cyclic_scrolling, "no", yes_no);
	p.add("lines_scrolled", &lines_scrolled, "2");
	p.add("lyrics_fetchers", &lyrics_fetchers,
	      "lyricwiki, azlyrics, genius, sing365, lyricsmania, metrolyrics, justsomelyrics, tekstowo, internet",
	      list_of<LyricsFetcher_>);
	p.add("follow_now_playing_lyrics", &now_playing_lyrics, "no", yes_no);
	p.add("fetch_lyrics_for_current_song_in_background", &fetch_lyrics_in_background,
	      "no", yes_no);
	p.add("store_lyrics_in_song_dir", &store_lyrics_in_song_dir, "no", yes_no);
	p.add("generate_win32_compatible_filenames", &generate_win32_compatible_filenames,
	      "yes", yes_no);
	p.add("allow_for_physical_item_deletion", &allow_for_physical_item_deletion,
	      "no", yes_no);
	p.add("lastfm_preferred_language", &lastfm_preferred_language, "en");
	p.add("space_add_mode", &space_add_mode, "add_remove");
	p.add("show_hidden_files_in_local_browser", &local_browser_show_hidden_files,
	      "no", yes_no);
	p.add<void>(
		"screen_switcher_mode", nullptr, "playlist, browser",
		[this](std::string v) {
			if (v == "previous")
				screen_switcher_previous = true;
			else
			{
				screen_switcher_previous = false;
				screen_sequence = list_of<ScreenType>(v, [](std::string s) {
						auto screen = stringtoStartupScreenType(s);
						if (screen == ScreenType::Unknown)
							invalid_value(s);
						return screen;
					});
			}
		});
	p.add("startup_screen", &startup_screen_type, "playlist", [](std::string v) {
			auto screen = stringtoStartupScreenType(v);
			if (screen == ScreenType::Unknown)
				invalid_value(v);
			return screen;
		});
	p.add("startup_slave_screen", &startup_slave_screen_type, "", [](std::string v) {
			boost::optional<ScreenType> screen;
			if (!v.empty())
			{
				screen = stringtoStartupScreenType(v);
				if (screen == ScreenType::Unknown)
					invalid_value(v);
			}
			return screen;
		});
	p.add("startup_slave_screen_focus", &startup_slave_screen_focus, "no", yes_no);
	p.add("locked_screen_width_part", &locked_screen_width_part,
	      "50", [](std::string v) {
		      return verbose_lexical_cast<double>(v) / 100;
	      });
	p.add("ask_for_locked_screen_width_part", &ask_for_locked_screen_width_part,
	      "yes", yes_no);
	p.add("jump_to_now_playing_song_at_start", &jump_to_now_playing_song_at_start,
	      "yes", yes_no);
	p.add("ask_before_clearing_playlists", &ask_before_clearing_playlists,
	      "yes", yes_no);
	p.add("ask_before_shuffling_playlists", &ask_before_shuffling_playlists,
	      "yes", yes_no);
	p.add("clock_display_seconds", &clock_display_seconds, "no", yes_no);
	p.add("display_volume_level", &display_volume_level, "yes", yes_no);
	p.add("display_bitrate", &display_bitrate, "no", yes_no);
	p.add("display_remaining_time", &display_remaining_time, "no", yes_no);
	p.add("regular_expressions", &regex_type, "perl", [](std::string v) {
			if (v == "none")
				return boost::regex::icase | boost::regex::literal;
			else if (v == "basic")
				return boost::regex::icase | boost::regex::basic;
			else if (v == "extended")
				return boost::regex::icase |  boost::regex::extended;
			else if (v == "perl")
				return boost::regex::icase | boost::regex::perl;
			else
				invalid_value(v);
	});
	p.add("ignore_leading_the", &ignore_leading_the, "no", yes_no);
	p.add("block_search_constraints_change_if_items_found",
	      &block_search_constraints_change, "yes", yes_no);
	p.add("mouse_support", &mouse_support, "yes", yes_no);
	p.add("mouse_list_scroll_whole_page", &mouse_list_scroll_whole_page, "yes", yes_no);
	p.add("empty_tag_marker", &empty_tag, "<empty>");
	p.add("tags_separator", &MPD::Song::TagsSeparator, " | ");
	p.add("tag_editor_extended_numeration", &tag_editor_extended_numeration, "no", yes_no);
	p.add("media_library_sort_by_mtime", &media_library_sort_by_mtime, "no", yes_no);
	p.add("enable_window_title", &set_window_title, "yes", [](std::string v) {
			// Consider this variable only if TERM variable is available and we're not
			// in emacs terminal nor tty (through any wrapper like screen).
			auto term = getenv("TERM");
			if (term != nullptr
			    && strstr(term, "linux") == nullptr
			    && strncmp(term, "eterm", const_strlen("eterm")))
				return yes_no(v);
			else
			{
				std::clog << "Terminal doesn't support window title, skipping 'enable_window_title'.\n";
				return false;
			}
		});
	p.add("search_engine_default_search_mode", &search_engine_default_search_mode,
	      "1", [](std::string v) {
		      auto mode = verbose_lexical_cast<unsigned>(v);
		      boundsCheck<unsigned>(mode, 1, 3);
		      return --mode;
	      });
	p.add("external_editor", &external_editor, "nano", adjust_path);
	p.add("use_console_editor", &use_console_editor, "yes", yes_no);
	p.add("colors_enabled", &colors_enabled, "yes", yes_no);
	p.add("empty_tag_color", &empty_tags_color, "cyan");
	p.add("header_window_color", &header_color, "default");
	p.add("volume_color", &volume_color, "default");
	p.add("state_line_color", &state_line_color, "default");
	p.add("state_flags_color", &state_flags_color, "default:b");
	p.add("main_window_color", &main_color, "yellow");
	p.add("color1", &color1, "white");
	p.add("color2", &color2, "green");
	p.add("main_window_highlight_color", &main_highlight_color, "yellow");
	p.add("progressbar_color", &progressbar_color, "black:b");
	p.add("progressbar_elapsed_color", &progressbar_elapsed_color, "green:b");
	p.add("statusbar_color", &statusbar_color, "default");
	p.add("statusbar_time_color", &statusbar_time_color, "default:b");
	p.add("player_state_color", &player_state_color, "default:b");
	p.add("alternative_ui_separator_color", &alternative_ui_separator_color, "black:b");
	p.add("active_column_color", &active_column_color, "red");
	p.add("window_border_color", &window_border, "green", verbose_lexical_cast<NC::Color>);
	p.add("active_window_border", &active_window_border, "red",
	      verbose_lexical_cast<NC::Color>);

	return std::all_of(
		config_paths.begin(),
		config_paths.end(),
		[&](const std::string &config_path) {
			std::ifstream f(config_path);
			if (f.is_open())
				std::clog << "Reading configuration from " << config_path << "...\n";
			return p.run(f, ignore_errors);
		}
	) && p.initialize_undefined(ignore_errors);
}
Ejemplo n.º 15
0
   *
   * @li Disable asio's I/O completion port backend by defining
   * BOOST_ASIO_DISABLE_IOCP.
   *
   * @li Use the close() function to simultaneously cancel the outstanding
   * operations and close the socket.
   *
   * When running on Windows Vista, Windows Server 2008, and later, the
   * CancelIoEx function is always used. This function does not have the
   * problems described above.
   */
#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) \
  && (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600) \
  && !defined(BOOST_ASIO_ENABLE_CANCELIO)
  __declspec(deprecated("By default, this function always fails with "
        "operation_not_supported when used on Windows XP, Windows Server 2003, "
        "or earlier. Consult documentation for details."))
#endif
  void cancel()
  {
    boost::system::error_code ec;
    this->service.cancel(this->implementation, ec);
    boost::asio::detail::throw_error(ec);
  }

  /// Cancel all asynchronous operations associated with the socket.
  /**
   * This function causes all outstanding asynchronous connect, send and receive
   * operations to finish immediately, and the handlers for cancelled operations
   * will be passed the boost::asio::error::operation_aborted error.
   *
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -verify -fsyntax-only %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
// RUN: cp %s %t
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fixit %t
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -Werror %t

#if !__has_feature(attribute_deprecated_with_replacement)
#error "Missing __has_feature"
#endif

#if !__has_feature(attribute_availability_with_replacement)
#error "Missing __has_feature"
#endif

void f_8(int) __attribute__((deprecated("message", "new8"))); // expected-note {{'f_8' has been explicitly marked deprecated here}}
void new8(int);
void f_2(int) __attribute__((availability(macosx,deprecated=9.0,replacement="new2"))); // expected-note {{'f_2' has been explicitly marked deprecated here}}
void new2(int);
void test() {
  f_8(0); // expected-warning{{'f_8' is deprecated}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:6}:"new8"
  f_2(0); // expected-warning{{'f_2' is deprecated: first deprecated in OS X 9.0}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:6}:"new2"
}
Ejemplo n.º 17
0
/* Test enumerators with attributes.  */
/* PR c/47043 */
/* { dg-do compile } */

enum E {
  A __attribute__((deprecated)),
  B __attribute__((deprecated ("foo"))),
  C __attribute__((deprecated)) = 10,
  D __attribute__((deprecated ("foo"))) = 15,
  E
};

int
f (int i)
{
  i += A; /* { dg-warning ".A. is deprecated" } */
  i += B; /* { dg-warning ".B. is deprecated" } */
  i += C; /* { dg-warning ".C. is deprecated" } */
  i += D; /* { dg-warning ".D. is deprecated" } */
  i += E;
  return i;
}