Date: Wed, 13 Nov 2013 08:45:38 +0000 (UTC) From: Mark Murray <markm@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r258087 - in projects/random_number_generator: . contrib/gcc contrib/gcc/cp contrib/gcc/doc contrib/mdocml etc etc/rc.d lib lib/libnv lib/libvmmapi sbin/nvmecontrol share/man/man5 share... Message-ID: <201311130845.rAD8jcNm044403@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markm Date: Wed Nov 13 08:45:37 2013 New Revision: 258087 URL: http://svnweb.freebsd.org/changeset/base/258087 Log: MFC - tracking commit Added: projects/random_number_generator/lib/libnv/ - copied from r258086, head/lib/libnv/ projects/random_number_generator/sys/amd64/vmm/io/vioapic.c - copied unchanged from r258086, head/sys/amd64/vmm/io/vioapic.c projects/random_number_generator/sys/amd64/vmm/io/vioapic.h - copied unchanged from r258086, head/sys/amd64/vmm/io/vioapic.h projects/random_number_generator/tools/regression/lib/libnv/ - copied from r258086, head/tools/regression/lib/libnv/ projects/random_number_generator/tools/regression/usr.sbin/etcupdate/preworld.sh - copied unchanged from r258086, head/tools/regression/usr.sbin/etcupdate/preworld.sh Deleted: projects/random_number_generator/usr.sbin/bhyve/ioapic.c projects/random_number_generator/usr.sbin/bhyve/ioapic.h Modified: projects/random_number_generator/Makefile.inc1 projects/random_number_generator/contrib/gcc/ChangeLog.gcc43 projects/random_number_generator/contrib/gcc/c-common.c projects/random_number_generator/contrib/gcc/c-common.h projects/random_number_generator/contrib/gcc/c-typeck.c projects/random_number_generator/contrib/gcc/cp/cp-tree.h projects/random_number_generator/contrib/gcc/cp/parser.c projects/random_number_generator/contrib/gcc/cp/pt.c projects/random_number_generator/contrib/gcc/cp/semantics.c projects/random_number_generator/contrib/gcc/cp/typeck.c projects/random_number_generator/contrib/gcc/doc/invoke.texi projects/random_number_generator/contrib/mdocml/lib.in projects/random_number_generator/etc/network.subr projects/random_number_generator/etc/rc.d/ftp-proxy projects/random_number_generator/etc/rc.d/pflog projects/random_number_generator/lib/Makefile projects/random_number_generator/lib/libvmmapi/vmmapi.c projects/random_number_generator/lib/libvmmapi/vmmapi.h projects/random_number_generator/sbin/nvmecontrol/firmware.c projects/random_number_generator/share/man/man5/rc.conf.5 projects/random_number_generator/share/mk/bsd.libnames.mk projects/random_number_generator/sys/amd64/include/vmm.h (contents, props changed) projects/random_number_generator/sys/amd64/include/vmm_dev.h (contents, props changed) projects/random_number_generator/sys/amd64/vmm/vmm.c projects/random_number_generator/sys/amd64/vmm/vmm_dev.c projects/random_number_generator/sys/dev/iwn/if_iwn.c projects/random_number_generator/sys/dev/usb/wlan/if_run.c projects/random_number_generator/sys/dev/usb/wlan/if_runreg.h projects/random_number_generator/sys/kern/subr_param.c projects/random_number_generator/sys/modules/vmm/Makefile projects/random_number_generator/sys/powerpc/include/param.h projects/random_number_generator/sys/sys/systm.h projects/random_number_generator/tools/regression/usr.sbin/etcupdate/always.sh projects/random_number_generator/tools/regression/usr.sbin/etcupdate/conflicts.sh projects/random_number_generator/tools/regression/usr.sbin/etcupdate/fbsdid.sh projects/random_number_generator/tools/regression/usr.sbin/etcupdate/ignore.sh projects/random_number_generator/tools/regression/usr.sbin/etcupdate/tests.sh projects/random_number_generator/usr.bin/svn/svn/Makefile projects/random_number_generator/usr.sbin/bhyve/Makefile projects/random_number_generator/usr.sbin/bhyve/bhyverun.c projects/random_number_generator/usr.sbin/bhyve/pci_emul.c projects/random_number_generator/usr.sbin/bhyve/pci_lpc.c projects/random_number_generator/usr.sbin/bhyve/pit_8254.c projects/random_number_generator/usr.sbin/etcupdate/etcupdate.8 projects/random_number_generator/usr.sbin/etcupdate/etcupdate.sh projects/random_number_generator/usr.sbin/syslogd/syslogd.c Directory Properties: projects/random_number_generator/ (props changed) projects/random_number_generator/contrib/gcc/ (props changed) projects/random_number_generator/lib/libvmmapi/ (props changed) projects/random_number_generator/sbin/ (props changed) projects/random_number_generator/sys/ (props changed) projects/random_number_generator/sys/amd64/vmm/ (props changed) projects/random_number_generator/sys/modules/vmm/ (props changed) projects/random_number_generator/usr.sbin/bhyve/ (props changed) Modified: projects/random_number_generator/Makefile.inc1 ============================================================================== --- projects/random_number_generator/Makefile.inc1 Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/Makefile.inc1 Wed Nov 13 08:45:37 2013 (r258087) @@ -136,7 +136,7 @@ REVISION!= make -C ${SRCDIR}/release -V BRANCH!= make -C ${SRCDIR}/release -V BRANCH SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ ${SRCDIR}/sys/sys/param.h -VERSION= FreeBSD ${REVISION}-${BRANCH} ${TARGET_ARCH} ${SRCRELDATE} +VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE} .endif KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64 Modified: projects/random_number_generator/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- projects/random_number_generator/contrib/gcc/ChangeLog.gcc43 Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/contrib/gcc/ChangeLog.gcc43 Wed Nov 13 08:45:37 2013 (r258087) @@ -232,6 +232,17 @@ * config.gcc: Support core2 processor. +2006-12-13 Ian Lance Taylor <iant@google.com> (r119855) + + PR c++/19564 + PR c++/19756 + * c-typeck.c (parser_build_binary_op): Move parentheses warnings + to warn_about_parentheses in c-common.c. + * c-common.c (warn_about_parentheses): New function. + * c-common.h (warn_about_parentheses): Declare. + * doc/invoke.texi (Warning Options): Update -Wparentheses + description. + 2006-12-02 H.J. Lu <hongjiu.lu@intel.com> (r119454 - partial) PR target/30040 Modified: projects/random_number_generator/contrib/gcc/c-common.c ============================================================================== --- projects/random_number_generator/contrib/gcc/c-common.c Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/contrib/gcc/c-common.c Wed Nov 13 08:45:37 2013 (r258087) @@ -2585,9 +2585,13 @@ c_common_truthvalue_conversion (tree exp break; case MODIFY_EXPR: - if (!TREE_NO_WARNING (expr)) - warning (OPT_Wparentheses, - "suggest parentheses around assignment used as truth value"); + if (!TREE_NO_WARNING (expr) + && warn_parentheses) + { + warning (OPT_Wparentheses, + "suggest parentheses around assignment used as truth value"); + TREE_NO_WARNING (expr) = 1; + } break; default: @@ -6471,5 +6475,87 @@ warn_array_subscript_with_type_char (tre warning (OPT_Wchar_subscripts, "array subscript has type %<char%>"); } +/* Implement -Wparentheses for the unexpected C precedence rules, to + cover cases like x + y << z which readers are likely to + misinterpret. We have seen an expression in which CODE is a binary + operator used to combine expressions headed by CODE_LEFT and + CODE_RIGHT. CODE_LEFT and CODE_RIGHT may be ERROR_MARK, which + means that that side of the expression was not formed using a + binary operator, or it was enclosed in parentheses. */ + +void +warn_about_parentheses (enum tree_code code, enum tree_code code_left, + enum tree_code code_right) +{ + if (!warn_parentheses) + return; + + if (code == LSHIFT_EXPR || code == RSHIFT_EXPR) + { + if (code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around + or - inside shift"); + } + + if (code == TRUTH_ORIF_EXPR) + { + if (code_left == TRUTH_ANDIF_EXPR + || code_right == TRUTH_ANDIF_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around && within ||"); + } + + if (code == BIT_IOR_EXPR) + { + if (code_left == BIT_AND_EXPR || code_left == BIT_XOR_EXPR + || code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == BIT_AND_EXPR || code_right == BIT_XOR_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around arithmetic in operand of |"); + /* Check cases like x|y==z */ + if (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison) + warning (OPT_Wparentheses, + "suggest parentheses around comparison in operand of |"); + } + + if (code == BIT_XOR_EXPR) + { + if (code_left == BIT_AND_EXPR + || code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == BIT_AND_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around arithmetic in operand of ^"); + /* Check cases like x^y==z */ + if (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison) + warning (OPT_Wparentheses, + "suggest parentheses around comparison in operand of ^"); + } + + if (code == BIT_AND_EXPR) + { + if (code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around + or - in operand of &"); + /* Check cases like x&y==z */ + if (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison) + warning (OPT_Wparentheses, + "suggest parentheses around comparison in operand of &"); + } + + /* Similarly, check for cases like 1<=i<=10 that are probably errors. */ + if (TREE_CODE_CLASS (code) == tcc_comparison + && (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison)) + warning (OPT_Wparentheses, "comparisons like X<=Y<=Z do not " + "have their mathematical meaning"); +} + #include "gt-c-common.h" Modified: projects/random_number_generator/contrib/gcc/c-common.h ============================================================================== --- projects/random_number_generator/contrib/gcc/c-common.h Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/contrib/gcc/c-common.h Wed Nov 13 08:45:37 2013 (r258087) @@ -850,6 +850,9 @@ extern int complete_array_type (tree *, extern tree builtin_type_for_size (int, bool); extern void warn_array_subscript_with_type_char (tree); +extern void warn_about_parentheses (enum tree_code, enum tree_code, + enum tree_code); + /* In c-gimplify.c */ extern void c_genericize (tree); Modified: projects/random_number_generator/contrib/gcc/c-typeck.c ============================================================================== --- projects/random_number_generator/contrib/gcc/c-typeck.c Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/contrib/gcc/c-typeck.c Wed Nov 13 08:45:37 2013 (r258087) @@ -2631,73 +2631,7 @@ parser_build_binary_op (enum tree_code c /* Check for cases such as x+y<<z which users are likely to misinterpret. */ if (warn_parentheses) - { - if (code == LSHIFT_EXPR || code == RSHIFT_EXPR) - { - if (code1 == PLUS_EXPR || code1 == MINUS_EXPR - || code2 == PLUS_EXPR || code2 == MINUS_EXPR) - warning (OPT_Wparentheses, - "suggest parentheses around + or - inside shift"); - } - - if (code == TRUTH_ORIF_EXPR) - { - if (code1 == TRUTH_ANDIF_EXPR - || code2 == TRUTH_ANDIF_EXPR) - warning (OPT_Wparentheses, - "suggest parentheses around && within ||"); - } - - if (code == BIT_IOR_EXPR) - { - if (code1 == BIT_AND_EXPR || code1 == BIT_XOR_EXPR - || code1 == PLUS_EXPR || code1 == MINUS_EXPR - || code2 == BIT_AND_EXPR || code2 == BIT_XOR_EXPR - || code2 == PLUS_EXPR || code2 == MINUS_EXPR) - warning (OPT_Wparentheses, - "suggest parentheses around arithmetic in operand of |"); - /* Check cases like x|y==z */ - if (TREE_CODE_CLASS (code1) == tcc_comparison - || TREE_CODE_CLASS (code2) == tcc_comparison) - warning (OPT_Wparentheses, - "suggest parentheses around comparison in operand of |"); - } - - if (code == BIT_XOR_EXPR) - { - if (code1 == BIT_AND_EXPR - || code1 == PLUS_EXPR || code1 == MINUS_EXPR - || code2 == BIT_AND_EXPR - || code2 == PLUS_EXPR || code2 == MINUS_EXPR) - warning (OPT_Wparentheses, - "suggest parentheses around arithmetic in operand of ^"); - /* Check cases like x^y==z */ - if (TREE_CODE_CLASS (code1) == tcc_comparison - || TREE_CODE_CLASS (code2) == tcc_comparison) - warning (OPT_Wparentheses, - "suggest parentheses around comparison in operand of ^"); - } - - if (code == BIT_AND_EXPR) - { - if (code1 == PLUS_EXPR || code1 == MINUS_EXPR - || code2 == PLUS_EXPR || code2 == MINUS_EXPR) - warning (OPT_Wparentheses, - "suggest parentheses around + or - in operand of &"); - /* Check cases like x&y==z */ - if (TREE_CODE_CLASS (code1) == tcc_comparison - || TREE_CODE_CLASS (code2) == tcc_comparison) - warning (OPT_Wparentheses, - "suggest parentheses around comparison in operand of &"); - } - /* Similarly, check for cases like 1<=i<=10 that are probably errors. */ - if (TREE_CODE_CLASS (code) == tcc_comparison - && (TREE_CODE_CLASS (code1) == tcc_comparison - || TREE_CODE_CLASS (code2) == tcc_comparison)) - warning (OPT_Wparentheses, "comparisons like X<=Y<=Z do not " - "have their mathematical meaning"); - - } + warn_about_parentheses (code, code1, code2); /* Warn about comparisons against string literals, with the exception of testing for equality or inequality of a string literal with NULL. */ Modified: projects/random_number_generator/contrib/gcc/cp/cp-tree.h ============================================================================== --- projects/random_number_generator/contrib/gcc/cp/cp-tree.h Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/contrib/gcc/cp/cp-tree.h Wed Nov 13 08:45:37 2013 (r258087) @@ -4460,8 +4460,9 @@ extern tree build_x_indirect_ref (tree, extern tree build_indirect_ref (tree, const char *); extern tree build_array_ref (tree, tree); extern tree get_member_function_from_ptrfunc (tree *, tree); -extern tree build_x_binary_op (enum tree_code, tree, tree, - bool *); +extern tree build_x_binary_op (enum tree_code, tree, + enum tree_code, tree, + enum tree_code, bool *); extern tree build_x_unary_op (enum tree_code, tree); extern tree unary_complex_lvalue (enum tree_code, tree); extern tree build_x_conditional_expr (tree, tree, tree); Modified: projects/random_number_generator/contrib/gcc/cp/parser.c ============================================================================== --- projects/random_number_generator/contrib/gcc/cp/parser.c Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/contrib/gcc/cp/parser.c Wed Nov 13 08:45:37 2013 (r258087) @@ -1177,8 +1177,15 @@ typedef enum cp_parser_status_kind typedef struct cp_parser_expression_stack_entry { + /* Left hand side of the binary operation we are currently + parsing. */ tree lhs; + /* Original tree code for left hand side, if it was a binary + expression itself (used for -Wparentheses). */ + enum tree_code lhs_type; + /* Tree code for the binary operation we are parsing. */ enum tree_code tree_type; + /* Precedence of the binary operation we are parsing. */ int prec; } cp_parser_expression_stack_entry; @@ -1536,7 +1543,7 @@ static tree cp_parser_builtin_offsetof /* Statements [gram.stmt.stmt] */ static void cp_parser_statement - (cp_parser *, tree, bool); + (cp_parser *, tree, bool, bool *); static void cp_parser_label_for_labeled_statement (cp_parser *); static tree cp_parser_expression_statement @@ -1546,7 +1553,7 @@ static tree cp_parser_compound_statement static void cp_parser_statement_seq_opt (cp_parser *, tree); static tree cp_parser_selection_statement - (cp_parser *); + (cp_parser *, bool *); static tree cp_parser_condition (cp_parser *); static tree cp_parser_iteration_statement @@ -1559,7 +1566,7 @@ static void cp_parser_declaration_statem (cp_parser *); static tree cp_parser_implicitly_scoped_statement - (cp_parser *); + (cp_parser *, bool *); static void cp_parser_already_scoped_statement (cp_parser *); @@ -5730,12 +5737,13 @@ cp_parser_binary_expression (cp_parser* cp_parser_expression_stack_entry *sp = &stack[0]; tree lhs, rhs; cp_token *token; - enum tree_code tree_type; + enum tree_code tree_type, lhs_type, rhs_type; enum cp_parser_prec prec = PREC_NOT_OPERATOR, new_prec, lookahead_prec; bool overloaded_p; /* Parse the first expression. */ lhs = cp_parser_cast_expression (parser, /*address_p=*/false, cast_p); + lhs_type = ERROR_MARK; for (;;) { @@ -5768,6 +5776,7 @@ cp_parser_binary_expression (cp_parser* /* Extract another operand. It may be the RHS of this expression or the LHS of a new, higher priority expression. */ rhs = cp_parser_simple_cast_expression (parser); + rhs_type = ERROR_MARK; /* Get another operator token. Look up its precedence to avoid building a useless (immediately popped) stack entry for common @@ -5783,8 +5792,10 @@ cp_parser_binary_expression (cp_parser* sp->prec = prec; sp->tree_type = tree_type; sp->lhs = lhs; + sp->lhs_type = lhs_type; sp++; lhs = rhs; + lhs_type = rhs_type; prec = new_prec; new_prec = lookahead_prec; goto get_rhs; @@ -5801,11 +5812,15 @@ cp_parser_binary_expression (cp_parser* prec = sp->prec; tree_type = sp->tree_type; rhs = lhs; + rhs_type = lhs_type; lhs = sp->lhs; + lhs_type = sp->lhs_type; } overloaded_p = false; - lhs = build_x_binary_op (tree_type, lhs, rhs, &overloaded_p); + lhs = build_x_binary_op (tree_type, lhs, lhs_type, rhs, rhs_type, + &overloaded_p); + lhs_type = tree_type; /* If the binary operator required the use of an overloaded operator, then this expression cannot be an integral constant-expression. @@ -6222,17 +6237,23 @@ cp_parser_builtin_offsetof (cp_parser *p try-block IN_COMPOUND is true when the statement is nested inside a - cp_parser_compound_statement; this matters for certain pragmas. */ + cp_parser_compound_statement; this matters for certain pragmas. + + If IF_P is not NULL, *IF_P is set to indicate whether the statement + is a (possibly labeled) if statement which is not enclosed in braces + and has an else clause. This is used to implement -Wparentheses. */ static void cp_parser_statement (cp_parser* parser, tree in_statement_expr, - bool in_compound) + bool in_compound, bool *if_p) { tree statement; cp_token *token; location_t statement_location; restart: + if (if_p != NULL) + *if_p = false; /* There is no statement yet. */ statement = NULL_TREE; /* Peek at the next token. */ @@ -6257,7 +6278,7 @@ cp_parser_statement (cp_parser* parser, case RID_IF: case RID_SWITCH: - statement = cp_parser_selection_statement (parser); + statement = cp_parser_selection_statement (parser, if_p); break; case RID_WHILE: @@ -6522,7 +6543,7 @@ cp_parser_statement_seq_opt (cp_parser* break; /* Parse the statement. */ - cp_parser_statement (parser, in_statement_expr, true); + cp_parser_statement (parser, in_statement_expr, true, NULL); } } @@ -6533,14 +6554,22 @@ cp_parser_statement_seq_opt (cp_parser* if ( condition ) statement else statement switch ( condition ) statement - Returns the new IF_STMT or SWITCH_STMT. */ + Returns the new IF_STMT or SWITCH_STMT. + + If IF_P is not NULL, *IF_P is set to indicate whether the statement + is a (possibly labeled) if statement which is not enclosed in + braces and has an else clause. This is used to implement + -Wparentheses. */ static tree -cp_parser_selection_statement (cp_parser* parser) +cp_parser_selection_statement (cp_parser* parser, bool *if_p) { cp_token *token; enum rid keyword; + if (if_p != NULL) + *if_p = false; + /* Peek at the next token. */ token = cp_parser_require (parser, CPP_KEYWORD, "selection-statement"); @@ -6576,11 +6605,13 @@ cp_parser_selection_statement (cp_parser if (keyword == RID_IF) { + bool nested_if; + /* Add the condition. */ finish_if_stmt_cond (condition, statement); /* Parse the then-clause. */ - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, &nested_if); finish_then_clause (statement); /* If the next token is `else', parse the else-clause. */ @@ -6591,8 +6622,28 @@ cp_parser_selection_statement (cp_parser cp_lexer_consume_token (parser->lexer); begin_else_clause (statement); /* Parse the else-clause. */ - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, NULL); finish_else_clause (statement); + + /* If we are currently parsing a then-clause, then + IF_P will not be NULL. We set it to true to + indicate that this if statement has an else clause. + This may trigger the Wparentheses warning below + when we get back up to the parent if statement. */ + if (if_p != NULL) + *if_p = true; + } + else + { + /* This if statement does not have an else clause. If + NESTED_IF is true, then the then-clause is an if + statement which does have an else clause. We warn + about the potential ambiguity. */ + if (nested_if) + warning (OPT_Wparentheses, + ("%Hsuggest explicit braces " + "to avoid ambiguous %<else%>"), + EXPR_LOCUS (statement)); } /* Now we're all done with the if-statement. */ @@ -6611,7 +6662,7 @@ cp_parser_selection_statement (cp_parser in_statement = parser->in_statement; parser->in_switch_statement_p = true; parser->in_statement |= IN_SWITCH_STMT; - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, NULL); parser->in_switch_statement_p = in_switch_statement_p; parser->in_statement = in_statement; @@ -6789,7 +6840,7 @@ cp_parser_iteration_statement (cp_parser statement = begin_do_stmt (); /* Parse the body of the do-statement. */ parser->in_statement = IN_ITERATION_STMT; - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, NULL); parser->in_statement = in_statement; finish_do_body (statement); /* Look for the `while' keyword. */ @@ -7031,13 +7082,21 @@ cp_parser_declaration_statement (cp_pars but ensures that is in its own scope, even if it is not a compound-statement. + If IF_P is not NULL, *IF_P is set to indicate whether the statement + is a (possibly labeled) if statement which is not enclosed in + braces and has an else clause. This is used to implement + -Wparentheses. + Returns the new statement. */ static tree -cp_parser_implicitly_scoped_statement (cp_parser* parser) +cp_parser_implicitly_scoped_statement (cp_parser* parser, bool *if_p) { tree statement; + if (if_p != NULL) + *if_p = false; + /* Mark if () ; with a special NOP_EXPR. */ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) { @@ -7053,7 +7112,7 @@ cp_parser_implicitly_scoped_statement (c /* Create a compound-statement. */ statement = begin_compound_stmt (0); /* Parse the dependent-statement. */ - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, if_p); /* Finish the dummy compound-statement. */ finish_compound_stmt (statement); } @@ -7072,7 +7131,7 @@ cp_parser_already_scoped_statement (cp_p { /* If the token is a `{', then we must take special action. */ if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)) - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); else { /* Avoid calling cp_parser_compound_statement, so that we @@ -18645,7 +18704,7 @@ cp_parser_omp_structured_block (cp_parse tree stmt = begin_omp_structured_block (); unsigned int save = cp_parser_begin_omp_structured_block (parser); - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); cp_parser_end_omp_structured_block (parser, save); return finish_omp_structured_block (stmt); @@ -18890,7 +18949,7 @@ cp_parser_omp_for_loop (cp_parser *parse /* Note that the grammar doesn't call for a structured block here, though the loop as a whole is a structured block. */ body = push_stmt_list (); - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); body = pop_stmt_list (body); return finish_omp_for (loc, decl, init, cond, incr, body, pre_body); @@ -18983,7 +19042,7 @@ cp_parser_omp_sections_scope (cp_parser while (1) { - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); tok = cp_lexer_peek_token (parser->lexer); if (tok->pragma_kind == PRAGMA_OMP_SECTION) Modified: projects/random_number_generator/contrib/gcc/cp/pt.c ============================================================================== --- projects/random_number_generator/contrib/gcc/cp/pt.c Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/contrib/gcc/cp/pt.c Wed Nov 13 08:45:37 2013 (r258087) @@ -9078,7 +9078,13 @@ tsubst_copy_and_build (tree t, return build_x_binary_op (TREE_CODE (t), RECUR (TREE_OPERAND (t, 0)), + (TREE_NO_WARNING (TREE_OPERAND (t, 0)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 0))), RECUR (TREE_OPERAND (t, 1)), + (TREE_NO_WARNING (TREE_OPERAND (t, 1)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 1))), /*overloaded_p=*/NULL); case SCOPE_REF: @@ -9087,7 +9093,14 @@ tsubst_copy_and_build (tree t, case ARRAY_REF: op1 = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0), args, complain, in_decl); - return build_x_binary_op (ARRAY_REF, op1, RECUR (TREE_OPERAND (t, 1)), + return build_x_binary_op (ARRAY_REF, op1, + (TREE_NO_WARNING (TREE_OPERAND (t, 0)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 0))), + RECUR (TREE_OPERAND (t, 1)), + (TREE_NO_WARNING (TREE_OPERAND (t, 1)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 1))), /*overloaded_p=*/NULL); case SIZEOF_EXPR: Modified: projects/random_number_generator/contrib/gcc/cp/semantics.c ============================================================================== --- projects/random_number_generator/contrib/gcc/cp/semantics.c Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/contrib/gcc/cp/semantics.c Wed Nov 13 08:45:37 2013 (r258087) @@ -587,6 +587,16 @@ maybe_convert_cond (tree cond) /* Do the conversion. */ cond = convert_from_reference (cond); + + if (TREE_CODE (cond) == MODIFY_EXPR + && !TREE_NO_WARNING (cond) + && warn_parentheses) + { + warning (OPT_Wparentheses, + "suggest parentheses around assignment used as truth value"); + TREE_NO_WARNING (cond) = 1; + } + return condition_conversion (cond); } Modified: projects/random_number_generator/contrib/gcc/cp/typeck.c ============================================================================== --- projects/random_number_generator/contrib/gcc/cp/typeck.c Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/contrib/gcc/cp/typeck.c Wed Nov 13 08:45:37 2013 (r258087) @@ -1690,17 +1690,20 @@ rationalize_conditional_expr (enum tree_ are equal, so we know what conditional expression this used to be. */ if (TREE_CODE (t) == MIN_EXPR || TREE_CODE (t) == MAX_EXPR) { + tree op0 = TREE_OPERAND (t, 0); + tree op1 = TREE_OPERAND (t, 1); + /* The following code is incorrect if either operand side-effects. */ - gcc_assert (!TREE_SIDE_EFFECTS (TREE_OPERAND (t, 0)) - && !TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1))); + gcc_assert (!TREE_SIDE_EFFECTS (op0) + && !TREE_SIDE_EFFECTS (op1)); return build_conditional_expr (build_x_binary_op ((TREE_CODE (t) == MIN_EXPR ? LE_EXPR : GE_EXPR), - TREE_OPERAND (t, 0), - TREE_OPERAND (t, 1), + op0, TREE_CODE (op0), + op1, TREE_CODE (op1), /*overloaded_p=*/NULL), - build_unary_op (code, TREE_OPERAND (t, 0), 0), - build_unary_op (code, TREE_OPERAND (t, 1), 0)); + build_unary_op (code, op0, 0), + build_unary_op (code, op1, 0)); } return @@ -2908,8 +2911,8 @@ convert_arguments (tree typelist, tree v conversions on the operands. CODE is the kind of expression to build. */ tree -build_x_binary_op (enum tree_code code, tree arg1, tree arg2, - bool *overloaded_p) +build_x_binary_op (enum tree_code code, tree arg1, enum tree_code arg1_code, + tree arg2, enum tree_code arg2_code, bool *overloaded_p) { tree orig_arg1; tree orig_arg2; @@ -2933,6 +2936,17 @@ build_x_binary_op (enum tree_code code, expr = build_new_op (code, LOOKUP_NORMAL, arg1, arg2, NULL_TREE, overloaded_p); + /* Check for cases such as x+y<<z which users are likely to + misinterpret. But don't warn about obj << x + y, since that is a + common idiom for I/O. */ + if (warn_parentheses + && !processing_template_decl + && !error_operand_p (arg1) + && !error_operand_p (arg2) + && (code != LSHIFT_EXPR + || !IS_AGGR_TYPE (TREE_TYPE (arg1)))) + warn_about_parentheses (code, arg1_code, arg2_code); + if (processing_template_decl && expr != error_mark_node) return build_min_non_dep (code, expr, orig_arg1, orig_arg2); @@ -6280,6 +6294,19 @@ convert_for_assignment (tree type, tree errtype); } + /* If -Wparentheses, warn about a = b = c when a has type bool and b + does not. */ + if (warn_parentheses + && type == boolean_type_node + && TREE_CODE (rhs) == MODIFY_EXPR + && !TREE_NO_WARNING (rhs) + && TREE_TYPE (rhs) != boolean_type_node) + { + warning (OPT_Wparentheses, + "suggest parentheses around assignment used as truth value"); + TREE_NO_WARNING (rhs) = 1; + } + return perform_implicit_conversion (strip_top_quals (type), rhs); } Modified: projects/random_number_generator/contrib/gcc/doc/invoke.texi ============================================================================== --- projects/random_number_generator/contrib/gcc/doc/invoke.texi Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/contrib/gcc/doc/invoke.texi Wed Nov 13 08:45:37 2013 (r258087) @@ -2212,9 +2212,7 @@ Warn if a user-supplied include director Warn if parentheses are omitted in certain contexts, such as when there is an assignment in a context where a truth value is expected, or when operators are nested whose precedence people -often get confused about. Only the warning for an assignment used as -a truth value is supported when compiling C++; the other warnings are -only supported when compiling C@. +often get confused about. Also warn if a comparison like @samp{x<=y<=z} appears; this is equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different @@ -2236,14 +2234,15 @@ such a case: @end group @end smallexample -In C, every @code{else} branch belongs to the innermost possible @code{if} -statement, which in this example is @code{if (b)}. This is often not -what the programmer expected, as illustrated in the above example by -indentation the programmer chose. When there is the potential for this -confusion, GCC will issue a warning when this flag is specified. -To eliminate the warning, add explicit braces around the innermost -@code{if} statement so there is no way the @code{else} could belong to -the enclosing @code{if}. The resulting code would look like this: +In C/C++, every @code{else} branch belongs to the innermost possible +@code{if} statement, which in this example is @code{if (b)}. This is +often not what the programmer expected, as illustrated in the above +example by indentation the programmer chose. When there is the +potential for this confusion, GCC will issue a warning when this flag +is specified. To eliminate the warning, add explicit braces around +the innermost @code{if} statement so there is no way the @code{else} +could belong to the enclosing @code{if}. The resulting code would +look like this: @smallexample @group Modified: projects/random_number_generator/contrib/mdocml/lib.in ============================================================================== --- projects/random_number_generator/contrib/mdocml/lib.in Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/contrib/mdocml/lib.in Wed Nov 13 08:45:37 2013 (r258087) @@ -67,6 +67,7 @@ LINE("libmemstat", "Kernel Memory Alloca LINE("libmenu", "Curses Menu Library (libmenu, \\-lmenu)") LINE("libnetgraph", "Netgraph User Library (libnetgraph, \\-lnetgraph)") LINE("libnetpgp", "Netpgp signing, verification, encryption and decryption (libnetpgp, \\-lnetpgp)") +LINE("libnv", "Name/value pairs library (libnv, \\-lnv)") LINE("libossaudio", "OSS Audio Emulation Library (libossaudio, \\-lossaudio)") LINE("libpam", "Pluggable Authentication Module Library (libpam, \\-lpam)") LINE("libpcap", "Packet Capture Library (libpcap, \\-lpcap)") Modified: projects/random_number_generator/etc/network.subr ============================================================================== --- projects/random_number_generator/etc/network.subr Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/etc/network.subr Wed Nov 13 08:45:37 2013 (r258087) @@ -1429,6 +1429,9 @@ childif_create() fi ${IFCONFIG_CMD} $i name $child && cfg=0 fi + if autoif $child; then + ifn_start $child + fi done # Create vlan interfaces @@ -1452,6 +1455,9 @@ childif_create() ${IFCONFIG_CMD} $i name $child && cfg=0 fi fi + if autoif $child; then + ifn_start $child + fi done return ${cfg} Modified: projects/random_number_generator/etc/rc.d/ftp-proxy ============================================================================== --- projects/random_number_generator/etc/rc.d/ftp-proxy Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/etc/rc.d/ftp-proxy Wed Nov 13 08:45:37 2013 (r258087) @@ -14,4 +14,62 @@ rcvar="ftpproxy_enable" command="/usr/sbin/ftp-proxy" load_rc_config $name -run_rc_command "$1" + +# +# manage_pid argument +# Create or remove a pidfile manually, for daemons that can't be bothered +# to do it themselves. Takes one argument, which is the argument provided +# to the rc script. The pidfile will be named /var/run/<$name>.pid, +# unless $pidfile is defined. +# +# The method used to determine the pid is rather hacky; grep ps output to +# find '$procname|$command', then grep for ${name}_flags. If at all +# possible, use another method if at all possible, to avoid that dirty- +# code feeling. +# +manage_pid() { + local search_string ps_pid + case $1 in + *start) + cmd_string=`basename ${procname:-${command}}` + eval flag_string=\"\$${name}_flags\" + # Determine the pid. + ps_pid=`ps ax -o pid= -o command= | grep $cmd_string | grep -e "$flag_string" | grep -v grep | awk '{ print $1 }'` + # Write the pidfile depending on $pidfile status. + echo $ps_pid > ${pidfile:-"/var/run/$name.pid"} + ;; + stop) + rm $pidfile + ;; + esac +} + +# Allow ftp-proxy to start up in two different ways. The typical behavior +# is to start up one instance of ftp-proxy by setting ftpproxy_enable and +# ftpproxy_flags. The alternate behavior allows multiple instances of ftp- +# proxy to be started, allowing different types of proxy behavior. To use the +# new behavior, a list of instances must be defined, and a list of flags for +# each instance. For example, if we want to start two instances of ftp-proxy, +# foo and bar, we would set the following vars. +# ftpproxy_enable="YES" +# ftpproxy_instances="foo bar" +# ftpproxy_foo="<arguments for foo>" +# ftpproxy_bar="<arguments for bar>" +# +# Starting more than one ftp-proxy? +if [ "$ftpproxy_instances" ] && [ -n "${ftpproxy_instances}" ]; then + # Iterate through instance list. + for i in $ftpproxy_instances; do + #eval ftpproxy_${i}_flags=\$ftpproxy_${i} + #eval name=ftpproxy_${i} + # Set flags for this instance. + eval ftpproxy_flags=\$ftpproxy_${i} + # Define a unique pid file name. + pidfile="/var/run/ftp-proxy.$i.pid" + run_rc_command "$1" + manage_pid $1 + done +else + # Traditional single-instance behavior + run_rc_command "$1" +fi Modified: projects/random_number_generator/etc/rc.d/pflog ============================================================================== --- projects/random_number_generator/etc/rc.d/pflog Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/etc/rc.d/pflog Wed Nov 13 08:45:37 2013 (r258087) @@ -24,25 +24,41 @@ pflog_prestart() { load_kld pflog || return 1 - # set pflog0 interface to up state - if ! ifconfig pflog0 up; then - warn 'could not bring up pflog0.' + # set pflog_dev interface to up state + if ! ifconfig $pflog_dev up; then + warn "could not bring up $pflog_dev." return 1 fi # prepare the command line for pflogd - rc_flags="-f $pflog_logfile $rc_flags" + rc_flags="-f $pflog_logfile -i $pflog_dev $rc_flags" # report we're ready to run pflogd return 0 } +pflog_poststart() { + # Allow child pflogd to settle + sleep 0.10 + # More elegant(?) method for getting a unique pid + if [ -f /var/run/pflogd.pid ]; then + mv /var/run/pflogd.pid $pidfile + else + warn "/var/run/pflogd.pid does not exist. Too fast." + fi +} + pflog_poststop() { - if ! ifconfig pflog0 down; then - warn 'could not bring down pflog0.' + if ! ifconfig $pflog_dev down; then + warn "could not bring down $pflog_dev." return 1 fi + + if [ "$pflog_instances" ] && [ -n "$pflog_instances" ]; then + rm $pidfile + fi + return 0 } @@ -53,4 +69,33 @@ pflog_resync() } load_rc_config $name -run_rc_command "$1" + +# Check if spawning multiple pflogd +echo "Starting pflogd: $pflog_instances" +if [ "$pflog_instances" ] && [ -n "$pflog_instances" ]; then + start_postcmd="pflog_poststart" + # Interate through requested instances. + for i in $pflog_instances; do + # Set required variables + eval pflog_dev=\$pflog_${i}_dev + eval pflog_logfile=\$pflog_${i}_logfile + eval pflog_flags=\$pflog_${i}_flags + # Check that required vars have non-zero length, warn if not. + if [ -z $pflog_dev ]; then + warn "pflog_dev not set" + continue + fi + if [ -z $pflog_logfile ]; then + warn "pflog_logfile not set" + continue + fi + # pflogd sets a pidfile, but the name is hardcoded. Concoct a + # unique pidfile name. + pidfile="/var/run/pflogd.$i.pid" + run_rc_command "$1" + done +else + # Typical case, spawn single instance only. + pflog_dev=${pflog_dev:-"pflog0"} + run_rc_command "$1" +fi Modified: projects/random_number_generator/lib/Makefile ============================================================================== --- projects/random_number_generator/lib/Makefile Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/lib/Makefile Wed Nov 13 08:45:37 2013 (r258087) @@ -94,6 +94,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libnandfs} \ libnetbsd \ ${_libngatm} \ + libnv \ libopie \ libpam \ libpcap \ Modified: projects/random_number_generator/lib/libvmmapi/vmmapi.c ============================================================================== --- projects/random_number_generator/lib/libvmmapi/vmmapi.c Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/lib/libvmmapi/vmmapi.c Wed Nov 13 08:45:37 2013 (r258087) @@ -397,6 +397,28 @@ vm_lapic_irq(struct vmctx *ctx, int vcpu } int +vm_ioapic_assert_irq(struct vmctx *ctx, int irq) +{ + struct vm_ioapic_irq ioapic_irq; + + bzero(&ioapic_irq, sizeof(struct vm_ioapic_irq)); + ioapic_irq.irq = irq; + + return (ioctl(ctx->fd, VM_IOAPIC_ASSERT_IRQ, &ioapic_irq)); +} + +int +vm_ioapic_deassert_irq(struct vmctx *ctx, int irq) +{ + struct vm_ioapic_irq ioapic_irq; + + bzero(&ioapic_irq, sizeof(struct vm_ioapic_irq)); + ioapic_irq.irq = irq; + + return (ioctl(ctx->fd, VM_IOAPIC_DEASSERT_IRQ, &ioapic_irq)); +} + +int vm_inject_nmi(struct vmctx *ctx, int vcpu) { struct vm_nmi vmnmi; Modified: projects/random_number_generator/lib/libvmmapi/vmmapi.h ============================================================================== --- projects/random_number_generator/lib/libvmmapi/vmmapi.h Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/lib/libvmmapi/vmmapi.h Wed Nov 13 08:45:37 2013 (r258087) @@ -67,6 +67,8 @@ int vm_inject_event(struct vmctx *ctx, i int vm_inject_event2(struct vmctx *ctx, int vcpu, enum vm_event_type type, int vector, int error_code); int vm_lapic_irq(struct vmctx *ctx, int vcpu, int vector); +int vm_ioapic_assert_irq(struct vmctx *ctx, int irq); +int vm_ioapic_deassert_irq(struct vmctx *ctx, int irq); int vm_inject_nmi(struct vmctx *ctx, int vcpu); int vm_capability_name2type(const char *capname); const char *vm_capability_type2name(int type); Modified: projects/random_number_generator/sbin/nvmecontrol/firmware.c ============================================================================== --- projects/random_number_generator/sbin/nvmecontrol/firmware.c Wed Nov 13 08:08:56 2013 (r258086) +++ projects/random_number_generator/sbin/nvmecontrol/firmware.c Wed Nov 13 08:45:37 2013 (r258087) @@ -141,7 +141,7 @@ update_firmware(int fd, uint8_t *payload } } -static void +static int activate_firmware(int fd, int slot, int activate_action) { struct nvme_pt_command pt; @@ -154,8 +154,14 @@ activate_firmware(int fd, int slot, int if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) err(1, "firmware activate request failed"); + if (pt.cpl.status.sct == NVME_SCT_COMMAND_SPECIFIC && + pt.cpl.status.sc == NVME_SC_FIRMWARE_REQUIRES_RESET) + return 1; + if (nvme_completion_is_error(&pt.cpl)) errx(1, "firmware activate request returned error"); + + return 0; } static void @@ -171,6 +177,7 @@ firmware(int argc, char *argv[]) { int fd = -1, slot = 0; int a_flag, s_flag, f_flag; + int activate_action, reboot_required; char ch, *p, *image = NULL; char *controller = NULL, prompt[64]; void *buf = NULL; @@ -287,21 +294,27 @@ firmware(int argc, char *argv[]) if (f_flag) { update_firmware(fd, buf, size); if (a_flag) - activate_firmware(fd, slot, - NVME_AA_REPLACE_ACTIVATE); + activate_action = NVME_AA_REPLACE_ACTIVATE; else - activate_firmware(fd, slot, - NVME_AA_REPLACE_NO_ACTIVATE); + activate_action = NVME_AA_REPLACE_NO_ACTIVATE; } else { - activate_firmware(fd, slot, NVME_AA_ACTIVATE); + activate_action = NVME_AA_ACTIVATE; } + reboot_required = activate_firmware(fd, slot, activate_action); + if (a_flag) { - printf("New firmware image activated and will take " - "effect after next controller reset.\n" - "Controller reset can be initiated via " - "'nvmecontrol reset %s'\n", - controller); + if (reboot_required) { + printf("New firmware image activated but requires " + "conventional reset (i.e. reboot) to " + "complete activation.\n"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311130845.rAD8jcNm044403>