Merge "build_system: Split COMPILE_DOUBLE from DONT_OPTIMIZE"

changes/17/2417/2
Joshua Colp 9 years ago committed by Gerrit Code Review
commit d108bee11b

@ -103,13 +103,15 @@ CC_LIBS=$(PTHREAD_LIBS) $(LIBS)
CXX_LIBS=$(PTHREAD_LIBS) $(LIBS)
# determine whether to double-compile so that the optimizer can report code path problems
# this is only done when developer mode and DONT_OPTIMIZE are both enabled
# in that case, we run the preprocessor to produce a .i or .ii file from the source
# In this case, we run the preprocessor to produce a .i or .ii file from the source
# code, then compile once with optimizer enabled (and the output to /dev/null),
# and if that doesn't fail then compile again with optimizer disabled
ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))$(AST_DEVMODE),DONT_OPTIMIZEyes)
ifeq ($(findstring COMPILE_DOUBLE,$(MENUSELECT_CFLAGS)),COMPILE_DOUBLE)
COMPILE_DOUBLE=yes
else
endif
ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))$(AST_DEVMODE),)
_ASTCFLAGS+=$(AST_FORTIFY_SOURCE)
endif

@ -1,5 +1,10 @@
<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" remove_on_change=".lastclean">
<member name="DONT_OPTIMIZE" displayname="Disable Optimizations by the Compiler">
<use autoselect="yes">COMPILE_DOUBLE</use>
<support_level>core</support_level>
</member>
<member name="COMPILE_DOUBLE" displayname="Pre-compile with optimizations to detect errors, then discard and recompile with DONT_OPTIMIZE. Creates intermediate .i files">
<depend>DONT_OPTIMIZE</depend>
<support_level>core</support_level>
</member>
<member name="DEBUG_THREADS" displayname="Enable Thread Debugging">

@ -357,6 +357,10 @@ static int process_xml_ref_node(xmlNode *node, struct member *mem, struct refere
}
}
if ((tmp = (const char *) xmlGetProp(node, BAD_CAST "autoselect"))) {
ref->autoselect = !strcasecmp(tmp, "yes");
}
tmp = (const char *) xmlNodeGetContent(node);
if (tmp && !strlen_zero(tmp)) {
@ -1154,8 +1158,16 @@ unsigned int enable_member(struct member *mem)
}
if ((mem->enabled = can_enable)) {
struct reference *use;
print_debug("Just set %s enabled to %d\n", mem->name, mem->enabled);
while (calc_dep_failures(1, 0) || calc_conflict_failures(1, 0));
AST_LIST_TRAVERSE(&mem->uses, use, list) {
if (use->member && use->autoselect && !use->member->enabled) {
enable_member(use->member);
}
}
}
return can_enable;

@ -43,6 +43,8 @@ struct reference {
struct member *member;
/*! if this package was found */
unsigned char met:1;
/*! if this package should be autoselected */
unsigned char autoselect:1;
/*! for linking */
AST_LIST_ENTRY(reference) list;
};

@ -158,6 +158,12 @@ static int really_quit(WINDOW *win)
return c;
}
#define MENU_HELP_LEFT_ADJ 16
#define MAIN_MENU_LEFT_ADJ 20
#define CAT_MENU_LEFT_ADJ 20
#define SCROLL_DOWN_LEFT_ADJ 15
#define MEMBER_INFO_LEFT_ADJ 25
static void draw_main_menu(WINDOW *menu, int curopt)
{
struct category *cat;
@ -167,42 +173,67 @@ static void draw_main_menu(WINDOW *menu, int curopt)
wclear(menu);
AST_LIST_TRAVERSE(&categories, cat, list) {
wmove(menu, i++, max_x / 2 - 10);
snprintf(buf, sizeof(buf), " %s", strlen_zero(cat->displayname) ? cat->name : cat->displayname);
wmove(menu, i++, max_x / 2 - MAIN_MENU_LEFT_ADJ);
snprintf(buf, sizeof(buf), "%s", strlen_zero(cat->displayname) ? cat->name : cat->displayname);
waddstr(menu, buf);
}
wmove(menu, curopt, (max_x / 2) - 15);
wmove(menu, curopt, (max_x / 2) - MAIN_MENU_LEFT_ADJ - 5);
waddstr(menu, "--->");
wmove(menu, 0, 0);
wmove(menu, curopt, (max_x / 2) - MAIN_MENU_LEFT_ADJ);
wrefresh(menu);
}
static void display_mem_info(WINDOW *menu, struct member *mem, int start, int end)
static void display_mem_info(WINDOW *menu, struct member *mem, int start_y, int end)
{
char buf[64];
struct reference *dep;
struct reference *con;
struct reference *use;
int start_x = (max_x / 2 - MEMBER_INFO_LEFT_ADJ);
int maxlen = (max_x - start_x);
wmove(menu, end - start + 2, max_x / 2 - 16);
wmove(menu, end - start_y + 1, start_x);
wclrtoeol(menu);
wmove(menu, end - start_y + 2, start_x);
wclrtoeol(menu);
wmove(menu, end - start + 3, max_x / 2 - 16);
wmove(menu, end - start_y + 3, start_x);
wclrtoeol(menu);
wmove(menu, end - start + 4, max_x / 2 - 16);
wmove(menu, end - start_y + 4, start_x);
wclrtoeol(menu);
wmove(menu, end - start + 5, max_x / 2 - 16);
wmove(menu, end - start_y + 5, start_x);
wclrtoeol(menu);
wmove(menu, end - start + 6, max_x / 2 - 16);
wmove(menu, end - start_y + 6, start_x);
wclrtoeol(menu);
if (mem->displayname) {
wmove(menu, end - start + 2, max_x / 2 - 16);
waddstr(menu, (char *) mem->displayname);
int name_len = strlen(mem->displayname);
wmove(menu, end - start_y + 1, start_x);
if (name_len > maxlen) {
char *last_space;
char *line_1 = strdup(mem->displayname);
if (line_1) {
line_1[maxlen] = '\0';
last_space = strrchr(line_1, ' ');
if (last_space) {
*last_space = '\0';
}
waddstr(menu, line_1);
wmove(menu, end - start_y + 2, start_x);
waddstr(menu, &mem->displayname[last_space - line_1]);
free(line_1);
} else {
waddstr(menu, (char *) mem->displayname);
}
} else {
waddstr(menu, (char *) mem->displayname);
}
}
if (!AST_LIST_EMPTY(&mem->deps)) {
wmove(menu, end - start + 3, max_x / 2 - 16);
wmove(menu, end - start_y + 3, start_x);
strcpy(buf, "Depends on: ");
AST_LIST_TRAVERSE(&mem->deps, dep, list) {
strncat(buf, dep->displayname, sizeof(buf) - strlen(buf) - 1);
@ -213,7 +244,7 @@ static void display_mem_info(WINDOW *menu, struct member *mem, int start, int en
waddstr(menu, buf);
}
if (!AST_LIST_EMPTY(&mem->uses)) {
wmove(menu, end - start + 4, max_x / 2 - 16);
wmove(menu, end - start_y + 4, start_x);
strcpy(buf, "Can use: ");
AST_LIST_TRAVERSE(&mem->uses, use, list) {
strncat(buf, use->displayname, sizeof(buf) - strlen(buf) - 1);
@ -224,7 +255,7 @@ static void display_mem_info(WINDOW *menu, struct member *mem, int start, int en
waddstr(menu, buf);
}
if (!AST_LIST_EMPTY(&mem->conflicts)) {
wmove(menu, end - start + 5, max_x / 2 - 16);
wmove(menu, end - start_y + 5, start_x);
strcpy(buf, "Conflicts with: ");
AST_LIST_TRAVERSE(&mem->conflicts, con, list) {
strncat(buf, con->displayname, sizeof(buf) - strlen(buf) - 1);
@ -237,7 +268,7 @@ static void display_mem_info(WINDOW *menu, struct member *mem, int start, int en
if (!mem->is_separator) { /* Separators lack support levels */
{ /* support level */
wmove(menu, end - start + 6, max_x / 2 - 16);
wmove(menu, end - start_y + 6, start_x);
snprintf(buf, sizeof(buf), "Support Level: %s", mem->support_level);
if (mem->replacement && *mem->replacement) {
char buf2[64];
@ -266,7 +297,7 @@ static void draw_category_menu(WINDOW *menu, struct category *cat, int start, in
break;
}
}
wmove(menu, curopt - start, max_x / 2 - 9);
wmove(menu, curopt - start, (max_x / 2) - (CAT_MENU_LEFT_ADJ - 1));
wrefresh(menu);
return;
}
@ -279,7 +310,7 @@ static void draw_category_menu(WINDOW *menu, struct category *cat, int start, in
i++;
continue;
}
wmove(menu, j++, max_x / 2 - 10);
wmove(menu, j++, max_x / 2 - CAT_MENU_LEFT_ADJ);
i++;
if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) {
snprintf(buf, sizeof(buf), "XXX %s", mem->name);
@ -302,11 +333,11 @@ static void draw_category_menu(WINDOW *menu, struct category *cat, int start, in
}
if (flags & SCROLL_DOWN) {
wmove(menu, j, max_x / 2 - sizeof(SCROLL_DOWN_INDICATOR) / 2);
wmove(menu, j, max_x / 2 - SCROLL_DOWN_LEFT_ADJ);
waddstr(menu, SCROLL_DOWN_INDICATOR);
}
wmove(menu, curopt - start, max_x / 2 - 9);
wmove(menu, curopt - start, (max_x / 2) - (CAT_MENU_LEFT_ADJ - 1));
wrefresh(menu);
}
@ -465,7 +496,7 @@ static void draw_title_window(WINDOW *title)
waddstr(title, (char *) menu_name);
wmove(title, 3, (max_x / 2) - (strlen(titlebar) / 2));
waddstr(title, titlebar);
wmove(title, 5, (max_x / 2) - (strlen(MENU_HELP) / 2));
wmove(title, 5, (max_x / 2) - MENU_HELP_LEFT_ADJ);
waddstr(title, MENU_HELP);
wrefresh(title);
}

Loading…
Cancel
Save