Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makefile: define as many make variables as possible before use #9547

Closed
pnkfelix opened this issue Sep 26, 2013 · 4 comments
Closed

makefile: define as many make variables as possible before use #9547

pnkfelix opened this issue Sep 26, 2013 · 4 comments

Comments

@pnkfelix
Copy link
Member

A bug (#9531) went undetected because I was careless and failed to put a variable definition before all of its uses (SHA: b1a2251).

Further investigation revealed that make does offer an --warn-undefined-variables option that will list all variables that are expanded without being provided a definition.

It might be good if we tried to minimize the number of warnings emitted by that flag, by putting explicit (even if empty) definitions up before their first use.

(Here's the list of warnings emitted, with obvious duplicate entries removed.)

% make -j1 --warn-undefined-variables
Makefile:76: warning: undefined variable `MAKE_RESTARTS'
cfg: build triple x86_64-apple-darwin
cfg: host triples x86_64-apple-darwin
cfg: target triples x86_64-apple-darwin
Makefile:91: warning: undefined variable `RUSTFLAGS'
cfg: enabling more debugging (CFG_ENABLE_DEBUG)
cfg: host for x86_64-apple-darwin is x86_64
cfg: os for x86_64-apple-darwin is apple-darwin
cfg: using ccache clang
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/platform.mk:370: warning: undefined variable `CFG_LDPATH_i686-pc-mingw32'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/platform.mk:422: warning: undefined variable `CFG_LDPATH_x86_64-w64-mingw32'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE0'
Makefile:497: warning: undefined variable `RUSTC_FLAGS_x86_64-apple-darwin'
Makefile:497: warning: undefined variable `CFG_PERF_TOOL'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE0'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE3'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE3'
Makefile:518: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
Makefile:518: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
Makefile:518: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
Makefile:548: warning: undefined variable `CFG_IN_TRANSITION'
Makefile:570: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `BORROWCK'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `CFG_PAXCTL'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT0_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/host.mk:148: warning: undefined variable `STDLIB_DSYM_GLOB'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:29: warning: undefined variable `1'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:29: warning: undefined variable `OSTYPE_'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:40: warning: undefined variable `MAKECMDGOALS'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_0'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_1'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_2'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_3'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT0_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `LIBRUST_DSYM_GLOB'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/docs.mk:41: warning: undefined variable `NO_DOCS'
Makefile:628: warning: undefined variable `MAKECMDGOALS'
make: Nothing to be done for `all'.
@pnkfelix
Copy link
Member Author

part of #8058

@huonw
Copy link
Member

huonw commented Aug 11, 2014

This appears to have gotten significantly worse: https://gist.github.com/huonw/bc37c9b56bd3a51450c1 (the sort | uniq'd output of a make --warn-undefined-variables in an already-built tree, i.e. with nothing meaningful to build).

@steveklabnik
Copy link
Member

Triage: no change. There's a lot of these, and it's hard to tell what to do with them.

@alexcrichton
Copy link
Member

Make's now gone, so closing.

flip1995 pushed a commit to flip1995/rust that referenced this issue Oct 6, 2022
fallout: fix tests to allow uninlined_format_args

In order to switch `clippy::uninlined_format_args` from pedantic to style, all existing tests must not raise a warning. I did not want to change the actual tests, so this is a relatively minor change that:

* add `#![allow(clippy::uninlined_format_args)]` where needed
* normalizes all allow/deny/warn attributes
   * all allow attributes are grouped together
   * sorted alphabetically
   * the `clippy::*` attributes are listed separate from the other ones.
   * deny and warn attributes are listed before the allowed ones

See also rust-lang/rust-clippy#9233, rust-lang/rust-clippy#9525, rust-lang/rust-clippy#9527

cc: `@llogiq` `@Alexendoo`

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants