From owner-svn-src-vendor@freebsd.org Tue Apr 25 03:28:39 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A88FCD4E85A; Tue, 25 Apr 2017 03:28:39 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79CED305; Tue, 25 Apr 2017 03:28:39 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3P3ScSX031968; Tue, 25 Apr 2017 03:28:38 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P3ScqP031963; Tue, 25 Apr 2017 03:28:38 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201704250328.v3P3ScqP031963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 25 Apr 2017 03:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317395 - vendor/less/dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 03:28:39 -0000 Author: delphij Date: Tue Apr 25 03:28:38 2017 New Revision: 317395 URL: https://svnweb.freebsd.org/changeset/base/317395 Log: Apply r316339 to vendor area. Modified: vendor/less/dist/brac.c vendor/less/dist/ch.c vendor/less/dist/charset.c vendor/less/dist/cmdbuf.c vendor/less/dist/command.c vendor/less/dist/cvt.c vendor/less/dist/decode.c vendor/less/dist/edit.c vendor/less/dist/filename.c vendor/less/dist/forwback.c vendor/less/dist/funcs.h vendor/less/dist/ifile.c vendor/less/dist/input.c vendor/less/dist/jump.c vendor/less/dist/less.h vendor/less/dist/lessecho.c vendor/less/dist/lesskey.c vendor/less/dist/line.c vendor/less/dist/linenum.c vendor/less/dist/lsystem.c vendor/less/dist/main.c vendor/less/dist/mark.c vendor/less/dist/mkhelp.c vendor/less/dist/optfunc.c vendor/less/dist/option.c vendor/less/dist/opttbl.c vendor/less/dist/os.c vendor/less/dist/output.c vendor/less/dist/pattern.c vendor/less/dist/position.c vendor/less/dist/prompt.c vendor/less/dist/regexp.c vendor/less/dist/screen.c vendor/less/dist/scrsize.c vendor/less/dist/search.c vendor/less/dist/signal.c vendor/less/dist/tags.c vendor/less/dist/ttyin.c Modified: vendor/less/dist/brac.c ============================================================================== --- vendor/less/dist/brac.c Tue Apr 25 00:00:34 2017 (r317394) +++ vendor/less/dist/brac.c Tue Apr 25 03:28:38 2017 (r317395) @@ -24,18 +24,14 @@ * "close bracket" are given. */ public void -match_brac(obrac, cbrac, forwdir, n) - register int obrac; - register int cbrac; - int forwdir; - int n; +match_brac(int obrac, int cbrac, int forwdir, int n) { - register int c; - register int nest; + int c; + int nest; POSITION pos; - int (*chget)(); + int (*chget)(void); - extern int ch_forw_get(), ch_back_get(); + extern int ch_forw_get(void), ch_back_get(void); /* * Seek to the line containing the open bracket. Modified: vendor/less/dist/ch.c ============================================================================== --- vendor/less/dist/ch.c Tue Apr 25 00:00:34 2017 (r317394) +++ vendor/less/dist/ch.c Tue Apr 25 03:28:38 2017 (r317395) @@ -144,13 +144,13 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get() +ch_get(void) { - register struct buf *bp; - register struct bufnode *bn; - register int n; - register int slept; - register int h; + struct buf *bp; + struct bufnode *bn; + int n; + int slept; + int h; POSITION pos; POSITION len; @@ -378,8 +378,7 @@ ch_get() * a single char onto an input file descriptor. */ public void -ch_ungetchar(c) - int c; +ch_ungetchar(int c) { if (c != -1 && ch_ungotchar != -1) error("ch_ungetchar overrun", NULL_PARG); @@ -392,7 +391,7 @@ ch_ungetchar(c) * If we haven't read all of standard input into it, do that now. */ public void -end_logfile() +end_logfile(void) { static int tried = FALSE; @@ -417,10 +416,10 @@ end_logfile() * Write all the existing buffered data to the log file. */ public void -sync_logfile() +sync_logfile(void) { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; int warned = FALSE; BLOCKNUM block; BLOCKNUM nblocks; @@ -454,12 +453,11 @@ sync_logfile() * Determine if a specific block is currently in one of the buffers. */ static int -buffered(block) - BLOCKNUM block; +buffered(BLOCKNUM block) { - register struct buf *bp; - register struct bufnode *bn; - register int h; + struct buf *bp; + struct bufnode *bn; + int h; h = BUFHASH(block); FOR_BUFS_IN_CHAIN(h, bn) @@ -476,8 +474,7 @@ buffered(block) * Return 0 if successful, non-zero if can't seek there. */ public int -ch_seek(pos) - register POSITION pos; +ch_seek(POSITION pos) { BLOCKNUM new_block; POSITION len; @@ -515,7 +512,7 @@ ch_seek(pos) * Seek to the end of the file. */ public int -ch_end_seek() +ch_end_seek(void) { POSITION len; @@ -542,10 +539,10 @@ ch_end_seek() * Seek to the last position in the file that is currently buffered. */ public int -ch_end_buffer_seek() +ch_end_buffer_seek(void) { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; POSITION buf_pos; POSITION end_pos; @@ -570,10 +567,10 @@ ch_end_buffer_seek() * beginning of the pipe is no longer buffered. */ public int -ch_beg_seek() +ch_beg_seek(void) { - register struct bufnode *bn; - register struct bufnode *firstbn; + struct bufnode *bn; + struct bufnode *firstbn; /* * Try a plain ch_seek first. @@ -602,7 +599,7 @@ ch_beg_seek() * Return the length of the file, if known. */ public POSITION -ch_length() +ch_length(void) { if (thisfile == NULL) return (NULL_POSITION); @@ -619,7 +616,7 @@ ch_length() * Return the current position in the file. */ public POSITION -ch_tell() +ch_tell(void) { if (thisfile == NULL) return (NULL_POSITION); @@ -630,9 +627,9 @@ ch_tell() * Get the current char and post-increment the read pointer. */ public int -ch_forw_get() +ch_forw_get(void) { - register int c; + int c; if (thisfile == NULL) return (EOI); @@ -653,7 +650,7 @@ ch_forw_get() * Pre-decrement the read pointer and get the new current char. */ public int -ch_back_get() +ch_back_get(void) { if (thisfile == NULL) return (EOI); @@ -676,8 +673,7 @@ ch_back_get() * bufspace is in units of 1024 bytes. -1 mean no limit. */ public void -ch_setbufspace(bufspace) - int bufspace; +ch_setbufspace(int bufspace) { if (bufspace < 0) maxbufs = -1; @@ -693,9 +689,9 @@ ch_setbufspace(bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush() +ch_flush(void) { - register struct bufnode *bn; + struct bufnode *bn; if (thisfile == NULL) return; @@ -760,10 +756,10 @@ ch_flush() * The buffer is added to the tail of the buffer chain. */ static int -ch_addbuf() +ch_addbuf(void) { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; /* * Allocate and initialize a new buffer and link it @@ -785,9 +781,9 @@ ch_addbuf() * */ static void -init_hashtbl() +init_hashtbl(void) { - register int h; + int h; for (h = 0; h < BUFHASH_SIZE; h++) { @@ -800,9 +796,9 @@ init_hashtbl() * Delete all buffers for this file. */ static void -ch_delbufs() +ch_delbufs(void) { - register struct bufnode *bn; + struct bufnode *bn; while (ch_bufhead != END_OF_CHAIN) { @@ -818,8 +814,7 @@ ch_delbufs() * Is it possible to seek on a file descriptor? */ public int -seekable(f) - int f; +seekable(int f) { #if MSDOS_COMPILER extern int fd0; @@ -840,7 +835,7 @@ seekable(f) * This is used after an ignore_eof read, during which the EOF may change. */ public void -ch_set_eof() +ch_set_eof(void) { ch_fsize = ch_fpos; } @@ -850,9 +845,7 @@ ch_set_eof() * Initialize file state for a new file. */ public void -ch_init(f, flags) - int f; - int flags; +ch_init(int f, int flags) { /* * See if we already have a filestate for this file. @@ -891,7 +884,7 @@ ch_init(f, flags) * Close a filestate. */ public void -ch_close() +ch_close(void) { int keepstate = FALSE; @@ -934,7 +927,7 @@ ch_close() * Return ch_flags for the current file. */ public int -ch_getflags() +ch_getflags(void) { if (thisfile == NULL) return (0); Modified: vendor/less/dist/charset.c ============================================================================== --- vendor/less/dist/charset.c Tue Apr 25 00:00:34 2017 (r317394) +++ vendor/less/dist/charset.c Tue Apr 25 03:28:38 2017 (r317395) @@ -130,12 +130,11 @@ public int binattr = AT_STANDOUT; * c control character */ static void -ichardef(s) - char *s; +ichardef(char *s) { - register char *cp; - register int n; - register char v; + char *cp; + int n; + char v; n = 0; v = 0; @@ -187,12 +186,10 @@ ichardef(s) * The valid charset names are listed in the "charsets" array. */ static int -icharset(name, no_error) - register char *name; - int no_error; +icharset(char *name, int no_error) { - register struct charset *p; - register struct cs_alias *a; + struct charset *p; + struct cs_alias *a; if (name == NULL || *name == '\0') return (0); @@ -230,9 +227,9 @@ icharset(name, no_error) * Define a charset, given a locale name. */ static void -ilocale() +ilocale(void) { - register int c; + int c; for (c = 0; c < (int) sizeof(chardef); c++) { @@ -250,10 +247,7 @@ ilocale() * Define the printing format for control (or binary utf) chars. */ static void -setbinfmt(s, fmtvarptr, default_fmt) - char *s; - char **fmtvarptr; - char *default_fmt; +setbinfmt(char *s, char **fmtvarptr, char *default_fmt) { if (s && utf_mode) { @@ -299,7 +293,7 @@ setbinfmt(s, fmtvarptr, default_fmt) * */ static void -set_charset() +set_charset(void) { char *s; @@ -370,7 +364,7 @@ set_charset() * Initialize charset data structures. */ public void -init_charset() +init_charset(void) { char *s; @@ -391,8 +385,7 @@ init_charset() * Is a given character a "binary" character? */ public int -binary_char(c) - LWCHAR c; +binary_char(LWCHAR c) { if (utf_mode) return (is_ubin_char(c)); @@ -404,8 +397,7 @@ binary_char(c) * Is a given character a "control" character? */ public int -control_char(c) - LWCHAR c; +control_char(LWCHAR c) { c &= 0377; return (chardef[c] & IS_CONTROL_CHAR); @@ -416,8 +408,7 @@ control_char(c) * For example, in the "ascii" charset '\3' is printed as "^C". */ public char * -prchar(c) - LWCHAR c; +prchar(LWCHAR c) { /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */ static char buf[32]; @@ -452,8 +443,7 @@ prchar(c) * Return the printable form of a UTF-8 character. */ public char * -prutfchar(ch) - LWCHAR ch; +prutfchar(LWCHAR ch) { static char buf[32]; @@ -483,8 +473,7 @@ prutfchar(ch) * Get the length of a UTF-8 character in bytes. */ public int -utf_len(ch) - char ch; +utf_len(char ch) { if ((ch & 0x80) == 0) return 1; @@ -506,9 +495,7 @@ utf_len(ch) * Does the parameter point to the lead byte of a well-formed UTF-8 character? */ public int -is_utf8_well_formed(s, slen) - unsigned char *s; - int slen; +is_utf8_well_formed(unsigned char *s, int slen) { int i; int len; @@ -543,9 +530,7 @@ is_utf8_well_formed(s, slen) * Return number of invalid UTF-8 sequences found in a buffer. */ public int -utf_bin_count(data, len) - unsigned char *data; - int len; +utf_bin_count(unsigned char *data, int len) { int bin_count = 0; while (len > 0) @@ -572,8 +557,7 @@ utf_bin_count(data, len) * Get the value of a UTF-8 character. */ public LWCHAR -get_wchar(p) - char *p; +get_wchar(constant char *p) { switch (utf_len(p[0])) { @@ -624,9 +608,7 @@ get_wchar(p) * Store a character into a UTF-8 string. */ public void -put_wchar(pp, ch) - char **pp; - LWCHAR ch; +put_wchar(char **pp, LWCHAR ch) { if (!utf_mode || ch < 0x80) { @@ -674,14 +656,11 @@ put_wchar(pp, ch) * Step forward or backward one character in a string. */ public LWCHAR -step_char(pp, dir, limit) - char **pp; - signed int dir; - char *limit; +step_char(constant char **pp, signed int dir, constant char *limit) { LWCHAR ch; int len; - char *p = *pp; + constant char *p = *pp; if (!utf_mode) { @@ -744,9 +723,7 @@ static struct wchar_range comb_table[] = static int -is_in_table(ch, table) - LWCHAR ch; - struct wchar_range_table *table; +is_in_table(LWCHAR ch, struct wchar_range_table *table) { int hi; int lo; @@ -774,8 +751,7 @@ is_in_table(ch, table) * If a composing character follows any char, the two combine into one glyph. */ public int -is_composing_char(ch) - LWCHAR ch; +is_composing_char(LWCHAR ch) { return is_in_table(ch, &compose_table); } @@ -784,8 +760,7 @@ is_composing_char(ch) * Should this UTF-8 character be treated as binary? */ public int -is_ubin_char(ch) - LWCHAR ch; +is_ubin_char(LWCHAR ch) { return is_in_table(ch, &ubin_table); } @@ -794,8 +769,7 @@ is_ubin_char(ch) * Is this a double width UTF-8 character? */ public int -is_wide_char(ch) - LWCHAR ch; +is_wide_char(LWCHAR ch) { return is_in_table(ch, &wide_table); } @@ -806,9 +780,7 @@ is_wide_char(ch) * a specific char (not any char), the two combine into one glyph. */ public int -is_combining_char(ch1, ch2) - LWCHAR ch1; - LWCHAR ch2; +is_combining_char(LWCHAR ch1, LWCHAR ch2) { /* The table is small; use linear search. */ int i; Modified: vendor/less/dist/cmdbuf.c ============================================================================== --- vendor/less/dist/cmdbuf.c Tue Apr 25 00:00:34 2017 (r317394) +++ vendor/less/dist/cmdbuf.c Tue Apr 25 03:28:38 2017 (r317395) @@ -32,7 +32,7 @@ static int literal; /* Next input char static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME -static int cmd_complete(); +static int cmd_complete(int action); /* * These variables are statics used by cmd_complete. */ @@ -114,7 +114,7 @@ static int cmd_mbc_buf_index; * Reset command buffer (to empty). */ public void -cmd_reset() +cmd_reset(void) { cp = cmdbuf; *cp = '\0'; @@ -129,7 +129,7 @@ cmd_reset() * Clear command line. */ public void -clear_cmd() +clear_cmd(void) { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -140,15 +140,14 @@ clear_cmd() * Display a string, usually as a prompt for input into the command buffer. */ public void -cmd_putstr(s) - char *s; +cmd_putstr(constant char *s) { LWCHAR prev_ch = 0; LWCHAR ch; - char *endline = s + strlen(s); + constant char *endline = s + strlen(s); while (*s != '\0') { - char *ns = s; + constant char *ns = s; ch = step_char(&ns, +1, endline); while (s < ns) putchr(*s++); @@ -171,10 +170,10 @@ cmd_putstr(s) * How many characters are in the command buffer? */ public int -len_cmdbuf() +len_cmdbuf(void) { - char *s = cmdbuf; - char *endline = s + strlen(s); + constant char *s = cmdbuf; + constant char *endline = s + strlen(s); int len = 0; while (*s != '\0') @@ -189,12 +188,7 @@ len_cmdbuf() * Common part of cmd_step_right() and cmd_step_left(). */ static char * -cmd_step_common(p, ch, len, pwidth, bswidth) - char *p; - LWCHAR ch; - int len; - int *pwidth; - int *bswidth; +cmd_step_common(constant char *p, LWCHAR ch, int len, int *pwidth, int *bswidth) { char *pr; @@ -256,13 +250,10 @@ cmd_step_common(p, ch, len, pwidth, bswi * Step a pointer one character right in the command buffer. */ static char * -cmd_step_right(pp, pwidth, bswidth) - char **pp; - int *pwidth; - int *bswidth; +cmd_step_right(char **pp, int *pwidth, int *bswidth) { char *p = *pp; - LWCHAR ch = step_char(pp, +1, p + strlen(p)); + LWCHAR ch = step_char((constant char **)pp, +1, p + strlen(p)); return cmd_step_common(p, ch, *pp - p, pwidth, bswidth); } @@ -271,13 +262,10 @@ cmd_step_right(pp, pwidth, bswidth) * Step a pointer one character left in the command buffer. */ static char * -cmd_step_left(pp, pwidth, bswidth) - char **pp; - int *pwidth; - int *bswidth; +cmd_step_left(char **pp, int *pwidth, int *bswidth) { char *p = *pp; - LWCHAR ch = step_char(pp, -1, cmdbuf); + LWCHAR ch = step_char((constant char **)pp, -1, cmdbuf); return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } @@ -287,8 +275,7 @@ cmd_step_left(pp, pwidth, bswidth) * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ static void -cmd_repaint(old_cp) - char *old_cp; +cmd_repaint(char *old_cp) { /* * Repaint the line from the current position. @@ -298,7 +285,7 @@ cmd_repaint(old_cp) { char *np = cp; int width; - char *pr = cmd_step_right(&np, &width, NULL); + constant char *pr = cmd_step_right(&np, &width, NULL); if (cmd_col + width >= sc_width) break; cp = np; @@ -328,7 +315,7 @@ cmd_repaint(old_cp) * and set cp to the corresponding char in cmdbuf. */ static void -cmd_home() +cmd_home(void) { while (cmd_col > prompt_col) { @@ -347,7 +334,7 @@ cmd_home() * Shift the cmdbuf display left a half-screen. */ static void -cmd_lshift() +cmd_lshift(void) { char *s; char *save_cp; @@ -385,7 +372,7 @@ cmd_lshift() * Shift the cmdbuf display right a half-screen. */ static void -cmd_rshift() +cmd_rshift(void) { char *s; char *save_cp; @@ -415,7 +402,7 @@ cmd_rshift() * Move cursor right one character. */ static int -cmd_right() +cmd_right(void) { char *pr; char *ncp; @@ -450,7 +437,7 @@ cmd_right() * Move cursor left one character. */ static int -cmd_left() +cmd_left(void) { char *ncp; int width, bswidth; @@ -480,9 +467,7 @@ cmd_left() * Insert a char into the command buffer, at the current position. */ static int -cmd_ichar(cs, clen) - char *cs; - int clen; +cmd_ichar(char *cs, int clen) { char *s; @@ -517,9 +502,9 @@ cmd_ichar(cs, clen) * Delete the char to the left of the cursor. */ static int -cmd_erase() +cmd_erase(void) { - register char *s; + char *s; int clen; if (cp == cmdbuf) @@ -566,7 +551,7 @@ cmd_erase() * Delete the char under the cursor. */ static int -cmd_delete() +cmd_delete(void) { if (*cp == '\0') { @@ -585,7 +570,7 @@ cmd_delete() * Delete the "word" to the left of the cursor. */ static int -cmd_werase() +cmd_werase(void) { if (cp > cmdbuf && cp[-1] == ' ') { @@ -611,7 +596,7 @@ cmd_werase() * Delete the "word" under the cursor. */ static int -cmd_wdelete() +cmd_wdelete(void) { if (*cp == ' ') { @@ -637,7 +622,7 @@ cmd_wdelete() * Delete all chars in the command buffer. */ static int -cmd_kill() +cmd_kill(void) { if (cmdbuf[0] == '\0') { @@ -663,9 +648,7 @@ cmd_kill() * Select an mlist structure to be the current command history. */ public void -set_mlist(mlist, cmdflags) - void *mlist; - int cmdflags; +set_mlist(constant void *mlist, int cmdflags) { #if CMD_HISTORY curr_mlist = (struct mlist *) mlist; @@ -684,8 +667,7 @@ set_mlist(mlist, cmdflags) * cmdbuf's corresponding chars. */ static int -cmd_updown(action) - int action; +cmd_updown(int action) { char *s; struct mlist *ml; @@ -747,10 +729,7 @@ cmd_updown(action) * Add a string to an mlist. */ public void -cmd_addhist(mlist, cmd, modified) - struct mlist *mlist; - char *cmd; - int modified; +cmd_addhist(struct mlist *constant mlist, char *cmd, int modified) { #if CMD_HISTORY struct mlist *ml; @@ -793,7 +772,7 @@ cmd_addhist(mlist, cmd, modified) * Add it to the currently selected history list. */ public void -cmd_accept() +cmd_accept(void) { #if CMD_HISTORY /* @@ -815,8 +794,7 @@ cmd_accept() * CC_QUIT The char requests the current command to be aborted. */ static int -cmd_edit(c) - int c; +cmd_edit(int c) { int action; int flags; @@ -931,8 +909,7 @@ cmd_edit(c) * Insert a string into the command buffer, at the current position. */ static int -cmd_istr(str) - char *str; +cmd_istr(char *str) { char *s; int action; @@ -941,7 +918,7 @@ cmd_istr(str) for (s = str; *s != '\0'; ) { char *os = s; - step_char(&s, +1, endline); + step_char((constant char **)&s, +1, endline); action = cmd_ichar(os, s - os); if (action != CC_OK) { @@ -959,7 +936,7 @@ cmd_istr(str) * cursor at the end of the word. */ static char * -delimit_word() +delimit_word(void) { char *word; #if SPACES_IN_FILENAMES @@ -1046,7 +1023,7 @@ delimit_word() * which start with that word, and set tk_text to that list. */ static void -init_compl() +init_compl(void) { char *word; char c; @@ -1109,9 +1086,7 @@ init_compl() * Return the next word in the current completion list. */ static char * -next_compl(action, prev) - int action; - char *prev; +next_compl(int action, char *prev) { switch (action) { @@ -1131,8 +1106,7 @@ next_compl(action, prev) * or a subsequent time (step thru the list). */ static int -cmd_complete(action) - int action; +cmd_complete(int action) { char *s; @@ -1229,8 +1203,7 @@ fail: * CC_ERROR The char could not be accepted due to an error. */ public int -cmd_char(c) - int c; +cmd_char(int c) { int action; int len; @@ -1319,8 +1292,7 @@ cmd_char(c) * Return the number currently in the command buffer. */ public LINENUM -cmd_int(frac) - long *frac; +cmd_int(long *frac) { char *p; LINENUM n = 0; @@ -1341,7 +1313,7 @@ cmd_int(frac) * Return a pointer to the command buffer. */ public char * -get_cmdbuf() +get_cmdbuf(void) { return (cmdbuf); } @@ -1351,7 +1323,7 @@ get_cmdbuf() * Return the last (most recent) string in the current command history. */ public char * -cmd_lastpattern() +cmd_lastpattern(void) { if (curr_mlist == NULL) return (NULL); @@ -1363,8 +1335,7 @@ cmd_lastpattern() /* */ static int -mlist_size(ml) - struct mlist *ml; +mlist_size(struct mlist *ml) { int size = 0; for (ml = ml->next; ml->string != NULL; ml = ml->next) @@ -1376,7 +1347,7 @@ mlist_size(ml) * Get the name of the history file. */ static char * -histfile_name() +histfile_name(void) { char *home; char *name; @@ -1416,11 +1387,8 @@ histfile_name() * Read a .lesshst file and call a callback for each line in the file. */ static void -read_cmdhist2(action, uparam, skip_search, skip_shell) - void (*action)(void*,struct mlist*,char*); - void *uparam; - int skip_search; - int skip_shell; +read_cmdhist2(void (*action)(void*,struct mlist*,char*), void *uparam, + int skip_search, int skip_shell) { struct mlist *ml = NULL; char line[CMDBUF_SIZE]; @@ -1480,11 +1448,8 @@ read_cmdhist2(action, uparam, skip_searc } static void -read_cmdhist(action, uparam, skip_search, skip_shell) - void (*action)(void*,struct mlist*,char*); - void *uparam; - int skip_search; - int skip_shell; +read_cmdhist(void (*action)(void*,struct mlist*,char*), void *uparam, + int skip_search, int skip_shell) { read_cmdhist2(action, uparam, skip_search, skip_shell); (*action)(uparam, NULL, NULL); /* signal end of file */ @@ -1503,7 +1468,7 @@ addhist_init(void *uparam, struct mlist * Initialize history from a .lesshist file. */ public void -init_cmdhist() +init_cmdhist(void) { #if CMD_HISTORY read_cmdhist(&addhist_init, NULL, 0, 0); @@ -1515,9 +1480,7 @@ init_cmdhist() */ #if CMD_HISTORY static void -write_mlist_header(ml, f) - struct mlist *ml; - FILE *f; +write_mlist_header(struct mlist *ml, FILE *f) { if (ml == &mlist_search) fprintf(f, "%s\n", HISTFILE_SEARCH_SECTION); @@ -1531,9 +1494,7 @@ write_mlist_header(ml, f) * Write all modified entries in an mlist to the history file. */ static void -write_mlist(ml, f) - struct mlist *ml; - FILE *f; +write_mlist(struct mlist *ml, FILE *f) { for (ml = ml->next; ml->string != NULL; ml = ml->next) { @@ -1549,8 +1510,7 @@ write_mlist(ml, f) * Make a temp name in the same directory as filename. */ static char * -make_tempname(filename) - char *filename; +make_tempname(char *filename) { char lastch; char *tempname = ecalloc(1, strlen(filename)+1); @@ -1613,8 +1573,7 @@ copy_hist(void *uparam, struct mlist *ml * Make a file readable only by its owner. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Tue Apr 25 03:42:19 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48BB1D4F249; Tue, 25 Apr 2017 03:42:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14D2010A3; Tue, 25 Apr 2017 03:42:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3P3gIF6039838; Tue, 25 Apr 2017 03:42:18 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P3gHmj039826; Tue, 25 Apr 2017 03:42:17 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201704250342.v3P3gHmj039826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 25 Apr 2017 03:42:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317397 - vendor/less/dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 03:42:19 -0000 Author: delphij Date: Tue Apr 25 03:42:16 2017 New Revision: 317397 URL: https://svnweb.freebsd.org/changeset/base/317397 Log: Vendor import of less 487. Modified: vendor/less/dist/LICENSE vendor/less/dist/Makefile.aut vendor/less/dist/Makefile.wnm vendor/less/dist/NEWS vendor/less/dist/README vendor/less/dist/brac.c vendor/less/dist/ch.c vendor/less/dist/charset.c vendor/less/dist/charset.h vendor/less/dist/cmd.h vendor/less/dist/cmdbuf.c vendor/less/dist/command.c vendor/less/dist/compose.uni vendor/less/dist/configure vendor/less/dist/configure.ac vendor/less/dist/cvt.c vendor/less/dist/decode.c vendor/less/dist/defines.ds vendor/less/dist/defines.o2 vendor/less/dist/defines.o9 vendor/less/dist/defines.wn vendor/less/dist/edit.c vendor/less/dist/filename.c vendor/less/dist/forwback.c vendor/less/dist/funcs.h vendor/less/dist/help.c vendor/less/dist/ifile.c vendor/less/dist/input.c vendor/less/dist/jump.c vendor/less/dist/less.h vendor/less/dist/less.hlp vendor/less/dist/less.man vendor/less/dist/less.nro vendor/less/dist/lessecho.c vendor/less/dist/lessecho.man vendor/less/dist/lessecho.nro vendor/less/dist/lesskey.c vendor/less/dist/lesskey.h vendor/less/dist/lesskey.man vendor/less/dist/lesskey.nro vendor/less/dist/lglob.h vendor/less/dist/line.c vendor/less/dist/linenum.c vendor/less/dist/lsystem.c vendor/less/dist/main.c vendor/less/dist/mark.c vendor/less/dist/mkhelp.c vendor/less/dist/mkutable vendor/less/dist/optfunc.c vendor/less/dist/option.c vendor/less/dist/option.h vendor/less/dist/opttbl.c vendor/less/dist/os.c vendor/less/dist/output.c vendor/less/dist/pattern.c vendor/less/dist/pattern.h vendor/less/dist/pckeys.h vendor/less/dist/position.c vendor/less/dist/position.h vendor/less/dist/prompt.c vendor/less/dist/regexp.c vendor/less/dist/screen.c vendor/less/dist/scrsize.c vendor/less/dist/search.c vendor/less/dist/signal.c vendor/less/dist/tags.c vendor/less/dist/ttyin.c vendor/less/dist/ubin.uni vendor/less/dist/version.c vendor/less/dist/wide.uni Modified: vendor/less/dist/LICENSE ============================================================================== --- vendor/less/dist/LICENSE Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/LICENSE Tue Apr 25 03:42:16 2017 (r317397) @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2015 Mark Nudelman +Copyright (C) 1984-2016 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: vendor/less/dist/Makefile.aut ============================================================================== --- vendor/less/dist/Makefile.aut Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/Makefile.aut Tue Apr 25 03:42:16 2017 (r317397) @@ -111,7 +111,7 @@ compose.uni: unicode/UnicodeData.txt ubin.uni: unicode/UnicodeData.txt ./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt > $@ wide.uni: unicode/EastAsianWidth.txt - ./mkutable -f1 W -- unicode/EastAsianWidth.txt > $@ + ./mkutable -f1 W F -- unicode/EastAsianWidth.txt > $@ distfiles: ${DISTFILES} Modified: vendor/less/dist/Makefile.wnm ============================================================================== --- vendor/less/dist/Makefile.wnm Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/Makefile.wnm Tue Apr 25 03:42:16 2017 (r317397) @@ -20,7 +20,7 @@ LIBS = user32.lib # This rule allows us to supply the necessary -D options # in addition to whatever the user asks for. -.c.obj: +.c.obj:: $(CC) $(CFLAGS) $< OBJ = \ @@ -33,11 +33,8 @@ OBJ = \ all: less.exe lesskey.exe -# This is really horrible, but the command line is too long for -# MS-DOS if we try to link ${OBJ}. less.exe: $(OBJ) - -del lesskey.obj - $(LD) $(LDFLAGS) *.obj $(LIBS) /out:$@ + $(LD) $(LDFLAGS) $** $(LIBS) /out:$@ lesskey.exe: lesskey.obj version.obj $(LD) $(LDFLAGS) lesskey.obj version.obj $(LIBS) /out:$@ Modified: vendor/less/dist/NEWS ============================================================================== --- vendor/less/dist/NEWS Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/NEWS Tue Apr 25 03:42:16 2017 (r317397) @@ -11,6 +11,26 @@ ====================================================================== + Major changes between "less" versions 481 and 487 + +* New commands ESC-{ and ESC-} to shift to start/end of displayed lines. + +* Make search highlights work correctly when changing caselessness with -i. + +* New option -Da in Windows version to enable SGR mode. + +* Fix "nothing to search" error when top or bottom line on screen is empty. + +* Fix bug when terminal has no "cm" termcap entry. + +* Fix incorrect display when entering double-width chars in search string. + +* Fix bug in Unicode handling that missed some double width characters. + +* Update Unicode database to 9.0.0. + +====================================================================== + Major changes between "less" versions 458 and 481 * Don't overwrite history file; just append to it. Modified: vendor/less/dist/README ============================================================================== --- vendor/less/dist/README Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/README Tue Apr 25 03:42:16 2017 (r317397) @@ -1,7 +1,7 @@ - Less, version 481 + Less, version 487 - This is the distribution of less, version 481, released 31 Aug 2015. + This is the distribution of less, version 487, released 25 Oct 2016. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or Modified: vendor/less/dist/brac.c ============================================================================== --- vendor/less/dist/brac.c Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/brac.c Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -24,14 +24,18 @@ * "close bracket" are given. */ public void -match_brac(int obrac, int cbrac, int forwdir, int n) +match_brac(obrac, cbrac, forwdir, n) + register int obrac; + register int cbrac; + int forwdir; + int n; { - int c; - int nest; + register int c; + register int nest; POSITION pos; - int (*chget)(void); + int (*chget)(); - extern int ch_forw_get(void), ch_back_get(void); + extern int ch_forw_get(), ch_back_get(); /* * Seek to the line containing the open bracket. Modified: vendor/less/dist/ch.c ============================================================================== --- vendor/less/dist/ch.c Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/ch.c Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -144,13 +144,13 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get(void) +ch_get() { - struct buf *bp; - struct bufnode *bn; - int n; - int slept; - int h; + register struct buf *bp; + register struct bufnode *bn; + register int n; + register int slept; + register int h; POSITION pos; POSITION len; @@ -378,7 +378,8 @@ ch_get(void) * a single char onto an input file descriptor. */ public void -ch_ungetchar(int c) +ch_ungetchar(c) + int c; { if (c != -1 && ch_ungotchar != -1) error("ch_ungetchar overrun", NULL_PARG); @@ -391,7 +392,7 @@ ch_ungetchar(int c) * If we haven't read all of standard input into it, do that now. */ public void -end_logfile(void) +end_logfile() { static int tried = FALSE; @@ -416,10 +417,10 @@ end_logfile(void) * Write all the existing buffered data to the log file. */ public void -sync_logfile(void) +sync_logfile() { - struct buf *bp; - struct bufnode *bn; + register struct buf *bp; + register struct bufnode *bn; int warned = FALSE; BLOCKNUM block; BLOCKNUM nblocks; @@ -453,11 +454,12 @@ sync_logfile(void) * Determine if a specific block is currently in one of the buffers. */ static int -buffered(BLOCKNUM block) +buffered(block) + BLOCKNUM block; { - struct buf *bp; - struct bufnode *bn; - int h; + register struct buf *bp; + register struct bufnode *bn; + register int h; h = BUFHASH(block); FOR_BUFS_IN_CHAIN(h, bn) @@ -474,7 +476,8 @@ buffered(BLOCKNUM block) * Return 0 if successful, non-zero if can't seek there. */ public int -ch_seek(POSITION pos) +ch_seek(pos) + register POSITION pos; { BLOCKNUM new_block; POSITION len; @@ -512,7 +515,7 @@ ch_seek(POSITION pos) * Seek to the end of the file. */ public int -ch_end_seek(void) +ch_end_seek() { POSITION len; @@ -539,10 +542,10 @@ ch_end_seek(void) * Seek to the last position in the file that is currently buffered. */ public int -ch_end_buffer_seek(void) +ch_end_buffer_seek() { - struct buf *bp; - struct bufnode *bn; + register struct buf *bp; + register struct bufnode *bn; POSITION buf_pos; POSITION end_pos; @@ -567,10 +570,10 @@ ch_end_buffer_seek(void) * beginning of the pipe is no longer buffered. */ public int -ch_beg_seek(void) +ch_beg_seek() { - struct bufnode *bn; - struct bufnode *firstbn; + register struct bufnode *bn; + register struct bufnode *firstbn; /* * Try a plain ch_seek first. @@ -599,7 +602,7 @@ ch_beg_seek(void) * Return the length of the file, if known. */ public POSITION -ch_length(void) +ch_length() { if (thisfile == NULL) return (NULL_POSITION); @@ -616,7 +619,7 @@ ch_length(void) * Return the current position in the file. */ public POSITION -ch_tell(void) +ch_tell() { if (thisfile == NULL) return (NULL_POSITION); @@ -627,9 +630,9 @@ ch_tell(void) * Get the current char and post-increment the read pointer. */ public int -ch_forw_get(void) +ch_forw_get() { - int c; + register int c; if (thisfile == NULL) return (EOI); @@ -650,7 +653,7 @@ ch_forw_get(void) * Pre-decrement the read pointer and get the new current char. */ public int -ch_back_get(void) +ch_back_get() { if (thisfile == NULL) return (EOI); @@ -673,7 +676,8 @@ ch_back_get(void) * bufspace is in units of 1024 bytes. -1 mean no limit. */ public void -ch_setbufspace(int bufspace) +ch_setbufspace(bufspace) + int bufspace; { if (bufspace < 0) maxbufs = -1; @@ -689,9 +693,9 @@ ch_setbufspace(int bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush(void) +ch_flush() { - struct bufnode *bn; + register struct bufnode *bn; if (thisfile == NULL) return; @@ -756,10 +760,10 @@ ch_flush(void) * The buffer is added to the tail of the buffer chain. */ static int -ch_addbuf(void) +ch_addbuf() { - struct buf *bp; - struct bufnode *bn; + register struct buf *bp; + register struct bufnode *bn; /* * Allocate and initialize a new buffer and link it @@ -781,9 +785,9 @@ ch_addbuf(void) * */ static void -init_hashtbl(void) +init_hashtbl() { - int h; + register int h; for (h = 0; h < BUFHASH_SIZE; h++) { @@ -796,9 +800,9 @@ init_hashtbl(void) * Delete all buffers for this file. */ static void -ch_delbufs(void) +ch_delbufs() { - struct bufnode *bn; + register struct bufnode *bn; while (ch_bufhead != END_OF_CHAIN) { @@ -814,7 +818,8 @@ ch_delbufs(void) * Is it possible to seek on a file descriptor? */ public int -seekable(int f) +seekable(f) + int f; { #if MSDOS_COMPILER extern int fd0; @@ -835,7 +840,7 @@ seekable(int f) * This is used after an ignore_eof read, during which the EOF may change. */ public void -ch_set_eof(void) +ch_set_eof() { ch_fsize = ch_fpos; } @@ -845,7 +850,9 @@ ch_set_eof(void) * Initialize file state for a new file. */ public void -ch_init(int f, int flags) +ch_init(f, flags) + int f; + int flags; { /* * See if we already have a filestate for this file. @@ -884,7 +891,7 @@ ch_init(int f, int flags) * Close a filestate. */ public void -ch_close(void) +ch_close() { int keepstate = FALSE; @@ -927,7 +934,7 @@ ch_close(void) * Return ch_flags for the current file. */ public int -ch_getflags(void) +ch_getflags() { if (thisfile == NULL) return (0); Modified: vendor/less/dist/charset.c ============================================================================== --- vendor/less/dist/charset.c Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/charset.c Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -64,6 +64,8 @@ struct cs_alias { char *oname; } cs_aliases[] = { { "UTF-8", "utf-8" }, + { "utf8", "utf-8" }, + { "UTF8", "utf-8" }, { "ANSI_X3.4-1968", "ascii" }, { "US-ASCII", "ascii" }, { "latin1", "iso8859" }, @@ -130,11 +132,12 @@ public int binattr = AT_STANDOUT; * c control character */ static void -ichardef(char *s) +ichardef(s) + char *s; { - char *cp; - int n; - char v; + register char *cp; + register int n; + register char v; n = 0; v = 0; @@ -186,10 +189,12 @@ ichardef(char *s) * The valid charset names are listed in the "charsets" array. */ static int -icharset(char *name, int no_error) +icharset(name, no_error) + register char *name; + int no_error; { - struct charset *p; - struct cs_alias *a; + register struct charset *p; + register struct cs_alias *a; if (name == NULL || *name == '\0') return (0); @@ -227,9 +232,9 @@ icharset(char *name, int no_error) * Define a charset, given a locale name. */ static void -ilocale(void) +ilocale() { - int c; + register int c; for (c = 0; c < (int) sizeof(chardef); c++) { @@ -247,7 +252,10 @@ ilocale(void) * Define the printing format for control (or binary utf) chars. */ static void -setbinfmt(char *s, char **fmtvarptr, char *default_fmt) +setbinfmt(s, fmtvarptr, default_fmt) + char *s; + char **fmtvarptr; + char *default_fmt; { if (s && utf_mode) { @@ -293,7 +301,7 @@ setbinfmt(char *s, char **fmtvarptr, cha * */ static void -set_charset(void) +set_charset() { char *s; @@ -364,7 +372,7 @@ set_charset(void) * Initialize charset data structures. */ public void -init_charset(void) +init_charset() { char *s; @@ -385,7 +393,8 @@ init_charset(void) * Is a given character a "binary" character? */ public int -binary_char(LWCHAR c) +binary_char(c) + LWCHAR c; { if (utf_mode) return (is_ubin_char(c)); @@ -397,7 +406,8 @@ binary_char(LWCHAR c) * Is a given character a "control" character? */ public int -control_char(LWCHAR c) +control_char(c) + LWCHAR c; { c &= 0377; return (chardef[c] & IS_CONTROL_CHAR); @@ -408,7 +418,8 @@ control_char(LWCHAR c) * For example, in the "ascii" charset '\3' is printed as "^C". */ public char * -prchar(LWCHAR c) +prchar(c) + LWCHAR c; { /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */ static char buf[32]; @@ -443,7 +454,8 @@ prchar(LWCHAR c) * Return the printable form of a UTF-8 character. */ public char * -prutfchar(LWCHAR ch) +prutfchar(ch) + LWCHAR ch; { static char buf[32]; @@ -473,7 +485,8 @@ prutfchar(LWCHAR ch) * Get the length of a UTF-8 character in bytes. */ public int -utf_len(char ch) +utf_len(ch) + char ch; { if ((ch & 0x80) == 0) return 1; @@ -495,7 +508,9 @@ utf_len(char ch) * Does the parameter point to the lead byte of a well-formed UTF-8 character? */ public int -is_utf8_well_formed(unsigned char *s, int slen) +is_utf8_well_formed(s, slen) + unsigned char *s; + int slen; { int i; int len; @@ -530,7 +545,9 @@ is_utf8_well_formed(unsigned char *s, in * Return number of invalid UTF-8 sequences found in a buffer. */ public int -utf_bin_count(unsigned char *data, int len) +utf_bin_count(data, len) + unsigned char *data; + int len; { int bin_count = 0; while (len > 0) @@ -557,7 +574,8 @@ utf_bin_count(unsigned char *data, int l * Get the value of a UTF-8 character. */ public LWCHAR -get_wchar(constant char *p) +get_wchar(p) + char *p; { switch (utf_len(p[0])) { @@ -608,7 +626,9 @@ get_wchar(constant char *p) * Store a character into a UTF-8 string. */ public void -put_wchar(char **pp, LWCHAR ch) +put_wchar(pp, ch) + char **pp; + LWCHAR ch; { if (!utf_mode || ch < 0x80) { @@ -656,11 +676,14 @@ put_wchar(char **pp, LWCHAR ch) * Step forward or backward one character in a string. */ public LWCHAR -step_char(constant char **pp, signed int dir, constant char *limit) +step_char(pp, dir, limit) + char **pp; + signed int dir; + char *limit; { LWCHAR ch; int len; - constant char *p = *pp; + char *p = *pp; if (!utf_mode) { @@ -723,7 +746,9 @@ static struct wchar_range comb_table[] = static int -is_in_table(LWCHAR ch, struct wchar_range_table *table) +is_in_table(ch, table) + LWCHAR ch; + struct wchar_range_table *table; { int hi; int lo; @@ -751,7 +776,8 @@ is_in_table(LWCHAR ch, struct wchar_rang * If a composing character follows any char, the two combine into one glyph. */ public int -is_composing_char(LWCHAR ch) +is_composing_char(ch) + LWCHAR ch; { return is_in_table(ch, &compose_table); } @@ -760,7 +786,8 @@ is_composing_char(LWCHAR ch) * Should this UTF-8 character be treated as binary? */ public int -is_ubin_char(LWCHAR ch) +is_ubin_char(ch) + LWCHAR ch; { return is_in_table(ch, &ubin_table); } @@ -769,7 +796,8 @@ is_ubin_char(LWCHAR ch) * Is this a double width UTF-8 character? */ public int -is_wide_char(LWCHAR ch) +is_wide_char(ch) + LWCHAR ch; { return is_in_table(ch, &wide_table); } @@ -780,7 +808,9 @@ is_wide_char(LWCHAR ch) * a specific char (not any char), the two combine into one glyph. */ public int -is_combining_char(LWCHAR ch1, LWCHAR ch2) +is_combining_char(ch1, ch2) + LWCHAR ch1; + LWCHAR ch2; { /* The table is small; use linear search. */ int i; Modified: vendor/less/dist/charset.h ============================================================================== --- vendor/less/dist/charset.h Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/charset.h Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: vendor/less/dist/cmd.h ============================================================================== --- vendor/less/dist/cmd.h Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/cmd.h Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -67,6 +67,8 @@ #define A_FILTER 55 #define A_F_UNTIL_HILITE 56 #define A_GOEND_BUF 57 +#define A_LLSHIFT 58 +#define A_RRSHIFT 59 #define A_INVALID 100 #define A_NOACTION 101 Modified: vendor/less/dist/cmdbuf.c ============================================================================== --- vendor/less/dist/cmdbuf.c Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/cmdbuf.c Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -32,7 +32,7 @@ static int literal; /* Next input char static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME -static int cmd_complete(int action); +static int cmd_complete(); /* * These variables are statics used by cmd_complete. */ @@ -114,7 +114,7 @@ static int cmd_mbc_buf_index; * Reset command buffer (to empty). */ public void -cmd_reset(void) +cmd_reset() { cp = cmdbuf; *cp = '\0'; @@ -129,7 +129,7 @@ cmd_reset(void) * Clear command line. */ public void -clear_cmd(void) +clear_cmd() { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -140,28 +140,27 @@ clear_cmd(void) * Display a string, usually as a prompt for input into the command buffer. */ public void -cmd_putstr(constant char *s) +cmd_putstr(s) + char *s; { LWCHAR prev_ch = 0; LWCHAR ch; - constant char *endline = s + strlen(s); + char *endline = s + strlen(s); while (*s != '\0') { - constant char *ns = s; + char *ns = s; + int width; ch = step_char(&ns, +1, endline); while (s < ns) putchr(*s++); if (!utf_mode) - { - cmd_col++; - prompt_col++; - } else if (!is_composing_char(ch) && - !is_combining_char(prev_ch, ch)) - { - int width = is_wide_char(ch) ? 2 : 1; - cmd_col += width; - prompt_col += width; - } + width = 1; + else if (is_composing_char(ch) || is_combining_char(prev_ch, ch)) + width = 0; + else + width = is_wide_char(ch) ? 2 : 1; + cmd_col += width; + prompt_col += width; prev_ch = ch; } } @@ -170,10 +169,10 @@ cmd_putstr(constant char *s) * How many characters are in the command buffer? */ public int -len_cmdbuf(void) +len_cmdbuf() { - constant char *s = cmdbuf; - constant char *endline = s + strlen(s); + char *s = cmdbuf; + char *endline = s + strlen(s); int len = 0; while (*s != '\0') @@ -186,63 +185,44 @@ len_cmdbuf(void) /* * Common part of cmd_step_right() and cmd_step_left(). + * {{ Returning pwidth and bswidth separately is a historical artifact + * since they're always the same. Maybe clean this up someday. }} */ static char * -cmd_step_common(constant char *p, LWCHAR ch, int len, int *pwidth, int *bswidth) +cmd_step_common(p, ch, len, pwidth, bswidth) + char *p; + LWCHAR ch; + int len; + int *pwidth; + int *bswidth; { char *pr; + int width; if (len == 1) { pr = prchar((int) ch); - if (pwidth != NULL || bswidth != NULL) - { - int len = (int) strlen(pr); - if (pwidth != NULL) - *pwidth = len; - if (bswidth != NULL) - *bswidth = len; - } + width = (int) strlen(pr); } else { pr = prutfchar(ch); - if (pwidth != NULL || bswidth != NULL) + if (is_composing_char(ch)) + width = 0; + else if (is_ubin_char(ch)) + width = (int) strlen(pr); + else { - if (is_composing_char(ch)) - { - if (pwidth != NULL) - *pwidth = 0; - if (bswidth != NULL) - *bswidth = 0; - } else if (is_ubin_char(ch)) - { - int len = (int) strlen(pr); - if (pwidth != NULL) - *pwidth = len; - if (bswidth != NULL) - *bswidth = len; - } else - { - LWCHAR prev_ch = step_char(&p, -1, cmdbuf); - if (is_combining_char(prev_ch, ch)) - { - if (pwidth != NULL) - *pwidth = 0; - if (bswidth != NULL) - *bswidth = 0; - } else - { - if (pwidth != NULL) - *pwidth = is_wide_char(ch) - ? 2 - : 1; - if (bswidth != NULL) - *bswidth = 1; - } - } + LWCHAR prev_ch = step_char(&p, -1, cmdbuf); + if (is_combining_char(prev_ch, ch)) + width = 0; + else + width = is_wide_char(ch) ? 2 : 1; } } - + if (pwidth != NULL) + *pwidth = width; + if (bswidth != NULL) + *bswidth = width; return (pr); } @@ -250,10 +230,13 @@ cmd_step_common(constant char *p, LWCHAR * Step a pointer one character right in the command buffer. */ static char * -cmd_step_right(char **pp, int *pwidth, int *bswidth) +cmd_step_right(pp, pwidth, bswidth) + char **pp; + int *pwidth; + int *bswidth; { char *p = *pp; - LWCHAR ch = step_char((constant char **)pp, +1, p + strlen(p)); + LWCHAR ch = step_char(pp, +1, p + strlen(p)); return cmd_step_common(p, ch, *pp - p, pwidth, bswidth); } @@ -262,10 +245,13 @@ cmd_step_right(char **pp, int *pwidth, i * Step a pointer one character left in the command buffer. */ static char * -cmd_step_left(char **pp, int *pwidth, int *bswidth) +cmd_step_left(pp, pwidth, bswidth) + char **pp; + int *pwidth; + int *bswidth; { char *p = *pp; - LWCHAR ch = step_char((constant char **)pp, -1, cmdbuf); + LWCHAR ch = step_char(pp, -1, cmdbuf); return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } @@ -275,7 +261,8 @@ cmd_step_left(char **pp, int *pwidth, in * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ static void -cmd_repaint(char *old_cp) +cmd_repaint(old_cp) + char *old_cp; { /* * Repaint the line from the current position. @@ -285,7 +272,7 @@ cmd_repaint(char *old_cp) { char *np = cp; int width; - constant char *pr = cmd_step_right(&np, &width, NULL); + char *pr = cmd_step_right(&np, &width, NULL); if (cmd_col + width >= sc_width) break; cp = np; @@ -315,7 +302,7 @@ cmd_repaint(char *old_cp) * and set cp to the corresponding char in cmdbuf. */ static void -cmd_home(void) +cmd_home() { while (cmd_col > prompt_col) { @@ -334,7 +321,7 @@ cmd_home(void) * Shift the cmdbuf display left a half-screen. */ static void -cmd_lshift(void) +cmd_lshift() { char *s; char *save_cp; @@ -372,7 +359,7 @@ cmd_lshift(void) * Shift the cmdbuf display right a half-screen. */ static void -cmd_rshift(void) +cmd_rshift() { char *s; char *save_cp; @@ -402,7 +389,7 @@ cmd_rshift(void) * Move cursor right one character. */ static int -cmd_right(void) +cmd_right() { char *pr; char *ncp; @@ -437,7 +424,7 @@ cmd_right(void) * Move cursor left one character. */ static int -cmd_left(void) +cmd_left() { char *ncp; int width, bswidth; @@ -467,7 +454,9 @@ cmd_left(void) * Insert a char into the command buffer, at the current position. */ static int -cmd_ichar(char *cs, int clen) +cmd_ichar(cs, clen) + char *cs; + int clen; { char *s; @@ -502,9 +491,9 @@ cmd_ichar(char *cs, int clen) * Delete the char to the left of the cursor. */ static int -cmd_erase(void) +cmd_erase() { - char *s; + register char *s; int clen; if (cp == cmdbuf) @@ -551,7 +540,7 @@ cmd_erase(void) * Delete the char under the cursor. */ static int -cmd_delete(void) +cmd_delete() { if (*cp == '\0') { @@ -570,7 +559,7 @@ cmd_delete(void) * Delete the "word" to the left of the cursor. */ static int -cmd_werase(void) +cmd_werase() { if (cp > cmdbuf && cp[-1] == ' ') { @@ -596,7 +585,7 @@ cmd_werase(void) * Delete the "word" under the cursor. */ static int -cmd_wdelete(void) +cmd_wdelete() { if (*cp == ' ') { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Tue Apr 25 03:43:08 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40D53D4F2ED; Tue, 25 Apr 2017 03:43:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED272129A; Tue, 25 Apr 2017 03:43:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3P3h6Ji039910; Tue, 25 Apr 2017 03:43:06 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P3h6Pv039909; Tue, 25 Apr 2017 03:43:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201704250343.v3P3h6Pv039909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 25 Apr 2017 03:43:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317398 - vendor/less/v487 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 03:43:08 -0000 Author: delphij Date: Tue Apr 25 03:43:06 2017 New Revision: 317398 URL: https://svnweb.freebsd.org/changeset/base/317398 Log: Tag less v487. Added: vendor/less/v487/ - copied from r317397, vendor/less/dist/ From owner-svn-src-vendor@freebsd.org Wed Apr 26 19:24:14 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24AB0D51BDC; Wed, 26 Apr 2017 19:24:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACAE98D6; Wed, 26 Apr 2017 19:24:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QJOCws030264; Wed, 26 Apr 2017 19:24:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJO9nr030234; Wed, 26 Apr 2017 19:24:09 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJO9nr030234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317447 - in vendor/clang/dist: cmake/caches docs include/clang-c include/clang/AST include/clang/ASTMatchers include/clang/Basic include/clang/Driver include/clang/Format include/clang... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:14 -0000 Author: dim Date: Wed Apr 26 19:24:09 2017 New Revision: 317447 URL: https://svnweb.freebsd.org/changeset/base/317447 Log: Vendor import of clang trunk r301441: https://llvm.org/svn/llvm-project/cfe/trunk@301441 Added: vendor/clang/dist/test/Analysis/null-deref-offsets.c (contents, props changed) vendor/clang/dist/test/CXX/modules-ts/ vendor/clang/dist/test/CXX/modules-ts/basic/ vendor/clang/dist/test/CXX/modules-ts/basic/basic.link/ vendor/clang/dist/test/CXX/modules-ts/basic/basic.link/module-declaration.cpp (contents, props changed) vendor/clang/dist/test/CXX/modules-ts/codegen-basics.cppm vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/p1.cpp (contents, props changed) vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1.cpp (contents, props changed) vendor/clang/dist/test/CodeGen/asan-globals-gc.cpp (contents, props changed) vendor/clang/dist/test/CoverageMapping/empty-destructor.cpp (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/crt1.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/crti.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/crtn.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/crtbegin.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/crtend.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/crt1.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/crti.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/crtn.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/crtbegin.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/crtend.o (contents, props changed) vendor/clang/dist/test/Driver/fuzzer.c (contents, props changed) vendor/clang/dist/test/Index/Core/external-source-symbol-attr.m vendor/clang/dist/test/Modules/Inputs/objc-desig-init/ vendor/clang/dist/test/Modules/Inputs/objc-desig-init/A.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/A2.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/Base.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/X.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/module.modulemap vendor/clang/dist/test/Modules/objc-designated-init-mod.m vendor/clang/dist/test/OpenMP/capturing_in_templates.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_if_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_private_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp (contents, props changed) vendor/clang/dist/test/SemaObjCXX/pr32725.mm Deleted: vendor/clang/dist/test/CodeGenCXX/modules-ts.cppm vendor/clang/dist/test/Parser/cxx-modules-import.cpp vendor/clang/dist/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp Modified: vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake vendor/clang/dist/docs/ClangFormat.rst vendor/clang/dist/include/clang-c/Index.h vendor/clang/dist/include/clang/AST/CommentSema.h vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h vendor/clang/dist/include/clang/Basic/Diagnostic.td vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Basic/Module.h vendor/clang/dist/include/clang/Basic/Sanitizers.def vendor/clang/dist/include/clang/Driver/CC1Options.td vendor/clang/dist/include/clang/Driver/SanitizerArgs.h vendor/clang/dist/include/clang/Format/Format.h vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def vendor/clang/dist/include/clang/Index/IndexSymbol.h vendor/clang/dist/include/clang/Index/USRGeneration.h vendor/clang/dist/include/clang/Sema/Sema.h vendor/clang/dist/lib/AST/Comment.cpp vendor/clang/dist/lib/AST/CommentSema.cpp vendor/clang/dist/lib/AST/Decl.cpp vendor/clang/dist/lib/AST/DeclCXX.cpp vendor/clang/dist/lib/AST/DeclObjC.cpp vendor/clang/dist/lib/CodeGen/BackendUtil.cpp vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp vendor/clang/dist/lib/CodeGen/CGExpr.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.h vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist/lib/CodeGen/CodeGenPGO.cpp vendor/clang/dist/lib/CodeGen/CodeGenPGO.h vendor/clang/dist/lib/Driver/SanitizerArgs.cpp vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp vendor/clang/dist/lib/Driver/ToolChains/CommonArgs.cpp vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp vendor/clang/dist/lib/Driver/ToolChains/Darwin.h vendor/clang/dist/lib/Driver/ToolChains/Gnu.cpp vendor/clang/dist/lib/Driver/ToolChains/Hexagon.cpp vendor/clang/dist/lib/Driver/ToolChains/Hexagon.h vendor/clang/dist/lib/Driver/ToolChains/Linux.cpp vendor/clang/dist/lib/Format/ContinuationIndenter.cpp vendor/clang/dist/lib/Format/Format.cpp vendor/clang/dist/lib/Format/FormatToken.h vendor/clang/dist/lib/Format/TokenAnnotator.cpp vendor/clang/dist/lib/Format/UnwrappedLineFormatter.cpp vendor/clang/dist/lib/Format/UnwrappedLineFormatter.h vendor/clang/dist/lib/Frontend/CompilerInvocation.cpp vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp vendor/clang/dist/lib/Headers/stdatomic.h vendor/clang/dist/lib/Index/IndexDecl.cpp vendor/clang/dist/lib/Index/IndexSymbol.cpp vendor/clang/dist/lib/Index/IndexTypeSourceInfo.cpp vendor/clang/dist/lib/Index/IndexingContext.cpp vendor/clang/dist/lib/Index/IndexingContext.h vendor/clang/dist/lib/Index/USRGeneration.cpp vendor/clang/dist/lib/Lex/ModuleMap.cpp vendor/clang/dist/lib/Lex/Pragma.cpp vendor/clang/dist/lib/Parse/ParseExpr.cpp vendor/clang/dist/lib/Parse/Parser.cpp vendor/clang/dist/lib/Sema/Sema.cpp vendor/clang/dist/lib/Sema/SemaChecking.cpp vendor/clang/dist/lib/Sema/SemaDecl.cpp vendor/clang/dist/lib/Sema/SemaDeclAttr.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/lib/Sema/SemaLookup.cpp vendor/clang/dist/lib/Sema/SemaOpenMP.cpp vendor/clang/dist/lib/Sema/TreeTransform.h vendor/clang/dist/lib/Serialization/ASTReader.cpp vendor/clang/dist/lib/Serialization/ASTWriter.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MallocChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/ExprEngine.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/RegionStore.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/Store.cpp vendor/clang/dist/test/Analysis/enum.cpp vendor/clang/dist/test/Analysis/gmalloc.c vendor/clang/dist/test/Analysis/inlining/inline-defensive-checks.c vendor/clang/dist/test/Analysis/inlining/inline-defensive-checks.cpp vendor/clang/dist/test/Analysis/uninit-const.cpp vendor/clang/dist/test/CodeGen/catch-undef-behavior.c vendor/clang/dist/test/CodeGen/pgo-sample-thinlto-summary.c vendor/clang/dist/test/CodeGen/sanitize-recover.c vendor/clang/dist/test/CodeGen/split-debug-filename.c vendor/clang/dist/test/CodeGenCXX/invariant.group-for-vptrs.cpp vendor/clang/dist/test/CodeGenCXX/ubsan-suppress-checks.cpp vendor/clang/dist/test/Driver/fsanitize.c vendor/clang/dist/test/Driver/hexagon-toolchain-elf.c vendor/clang/dist/test/Driver/linux-ld.c vendor/clang/dist/test/Driver/modules-ts.cpp vendor/clang/dist/test/Driver/sanitizer-ld.c vendor/clang/dist/test/Driver/split-debug.c vendor/clang/dist/test/Format/incomplete.cpp vendor/clang/dist/test/Headers/stdatomic.c vendor/clang/dist/test/Index/Core/index-source.cpp vendor/clang/dist/test/Index/Core/index-source.m vendor/clang/dist/test/Index/index-refs.cpp vendor/clang/dist/test/Index/print-type.cpp vendor/clang/dist/test/Modules/Inputs/template-default-args/a.h vendor/clang/dist/test/Modules/Inputs/template-default-args/d.h vendor/clang/dist/test/Modules/localsubmodulevis.m vendor/clang/dist/test/Modules/template-default-args.cpp vendor/clang/dist/test/Parser/cxx-modules-interface.cppm vendor/clang/dist/test/Preprocessor/init.c vendor/clang/dist/test/Sema/atomic-ops.c vendor/clang/dist/test/Sema/warn-documentation.cpp vendor/clang/dist/test/Sema/warn-documentation.m vendor/clang/dist/test/SemaCXX/MicrosoftCompatibility.cpp vendor/clang/dist/test/SemaCXX/MicrosoftExtensions.cpp vendor/clang/dist/test/SemaCXX/modules-ts.cppm vendor/clang/dist/test/SemaObjC/unguarded-availability.m vendor/clang/dist/test/SemaOpenCL/cl20-device-side-enqueue.cl vendor/clang/dist/tools/c-index-test/c-index-test.c vendor/clang/dist/tools/clang-format/ClangFormat.cpp vendor/clang/dist/tools/clang-format/git-clang-format vendor/clang/dist/tools/libclang/CXIndexDataConsumer.cpp vendor/clang/dist/tools/libclang/CXType.cpp vendor/clang/dist/unittests/Format/CleanupTest.cpp vendor/clang/dist/unittests/Format/FormatTest.cpp vendor/clang/dist/unittests/Format/FormatTestComments.cpp vendor/clang/dist/unittests/Format/FormatTestJS.cpp vendor/clang/dist/unittests/Format/FormatTestObjC.cpp vendor/clang/dist/unittests/Format/FormatTestSelective.cpp vendor/clang/dist/unittests/Format/NamespaceEndCommentsFixerTest.cpp Modified: vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake ============================================================================== --- vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake Wed Apr 26 19:24:09 2017 (r317447) @@ -1,7 +1,7 @@ # This file sets up a CMakeCache for the second stage of a Fuchsia toolchain # build. -set(LLVM_TARGETS_TO_BUILD X86;AArch64 CACHE STRING "") +set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "") set(PACKAGE_VENDOR Fuchsia CACHE STRING "") @@ -36,6 +36,7 @@ set(BUILTINS_aarch64-fuchsia-none_CMAKE_ # Setup toolchain. set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") set(LLVM_TOOLCHAIN_TOOLS + llc llvm-ar llvm-cov llvm-cxxfilt @@ -49,6 +50,7 @@ set(LLVM_TOOLCHAIN_TOOLS llvm-readobj llvm-size llvm-symbolizer + opt CACHE STRING "") set(LLVM_DISTRIBUTION_COMPONENTS Modified: vendor/clang/dist/docs/ClangFormat.rst ============================================================================== --- vendor/clang/dist/docs/ClangFormat.rst Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/docs/ClangFormat.rst Wed Apr 26 19:24:09 2017 (r317447) @@ -162,8 +162,9 @@ Download the latest Visual Studio extens Script for patch reformatting ============================= -The python script `clang/tools/clang-format-diff.py` parses the output of -a unified diff and reformats all contained lines with :program:`clang-format`. +The python script `clang/tools/clang-format/clang-format-diff.py` parses the +output of a unified diff and reformats all contained lines with +:program:`clang-format`. .. code-block:: console Modified: vendor/clang/dist/include/clang-c/Index.h ============================================================================== --- vendor/clang/dist/include/clang-c/Index.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang-c/Index.h Wed Apr 26 19:24:09 2017 (r317447) @@ -5600,7 +5600,8 @@ typedef enum { CXIdxEntityLang_None = 0, CXIdxEntityLang_C = 1, CXIdxEntityLang_ObjC = 2, - CXIdxEntityLang_CXX = 3 + CXIdxEntityLang_CXX = 3, + CXIdxEntityLang_Swift = 4 } CXIdxEntityLanguage; /** Modified: vendor/clang/dist/include/clang/AST/CommentSema.h ============================================================================== --- vendor/clang/dist/include/clang/AST/CommentSema.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/AST/CommentSema.h Wed Apr 26 19:24:09 2017 (r317447) @@ -208,6 +208,10 @@ public: /// \returns \c true if declaration that this comment is attached to declares /// a function pointer. bool isFunctionPointerVarDecl(); + /// \returns \c true if the declaration that this comment is attached to + /// declares a variable or a field whose type is a function or a block + /// pointer. + bool isFunctionOrBlockPointerVarLikeDecl(); bool isFunctionOrMethodVariadic(); bool isObjCMethodDecl(); bool isObjCPropertyDecl(); Modified: vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h ============================================================================== --- vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h Wed Apr 26 19:24:09 2017 (r317447) @@ -1406,7 +1406,7 @@ const internal::VariadicDynCastAllOfMatc /// /// Example: Given /// \code -/// struct T {void func()}; +/// struct T {void func();}; /// T f(); /// void g(T); /// \endcode Modified: vendor/clang/dist/include/clang/Basic/Diagnostic.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/Diagnostic.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/Diagnostic.td Wed Apr 26 19:24:09 2017 (r317447) @@ -12,6 +12,8 @@ // //===----------------------------------------------------------------------===// +// See the Internals Manual, section The Diagnostics Subsystem for an overview. + // Define the diagnostic severities. class Severity { string Name = N; @@ -100,10 +102,20 @@ class SuppressInSystemHeader { class Error : Diagnostic, SFINAEFailure { bit ShowInSystemHeader = 1; } +// Warnings default to on (but can be default-off'd with DefaultIgnore). +// This is used for warnings about questionable code; warnings about +// accepted language extensions should use Extension or ExtWarn below instead. class Warning : Diagnostic; +// Remarks can be turned on with -R flags and provide commentary, e.g. on +// optimizer decisions. class Remark : Diagnostic; +// Extensions are warnings about accepted language extensions. +// Extension warnings are default-off but enabled by -pedantic. class Extension : Diagnostic; +// ExtWarns are warnings about accepted language extensions. +// ExtWarn warnings are default-on. class ExtWarn : Diagnostic; +// Notes can provide supplementary information on errors, warnings, and remarks. class Note : Diagnostic; Modified: vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td Wed Apr 26 19:24:09 2017 (r317447) @@ -1114,14 +1114,12 @@ def err_pragma_cannot_end_force_cuda_hos } // end of Parse Issue category. let CategoryName = "Modules Issue" in { -def err_expected_module_interface_decl : Error< - "expected module declaration at start of module interface">; def err_unexpected_module_decl : Error< - "module declaration must be the first declaration in the translation unit">; + "module declaration can only appear at the top level">; def err_module_expected_ident : Error< - "expected a module name after module%select{| import}0">; -def err_unexpected_module_kind : Error< - "unexpected module kind %0; expected 'implementation' or 'partition'">; + "expected a module name after '%select{module|import}0'">; +def err_module_implementation_partition : Error< + "module partition must be declared 'export'">; def err_attribute_not_module_attr : Error< "%0 attribute cannot be applied to a module">; def err_attribute_not_import_attr : Error< Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Wed Apr 26 19:24:09 2017 (r317447) @@ -8801,9 +8801,11 @@ def err_invalid_type_for_program_scope_v } let CategoryName = "Modules Issue" in { +def err_module_decl_in_module_map_module : Error< + "'module' declaration found while building module from module map">; def err_module_interface_implementation_mismatch : Error< - "%select{'module'|'module partition'|'module implementation'}0 declaration " - "found while %select{not |not |}0building module interface">; + "missing 'export' specifier in module declaration while " + "building module interface">; def err_current_module_name_mismatch : Error< "module name '%0' specified on command line does not match name of module">; def err_module_redefinition : Error< @@ -8846,8 +8848,13 @@ def err_module_self_import : Error< "import of module '%0' appears within same top-level module '%1'">; def err_module_import_in_implementation : Error< "@import of module '%0' in implementation of '%1'; use #import">; + +// C++ Modules TS def err_export_within_export : Error< "export declaration appears within another export declaration">; +def err_export_not_in_module_interface : Error< + "export declaration can only be used within a module interface unit after " + "the module declaration">; def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn< "ambiguous use of internal linkage declaration %0 defined in multiple modules">, Modified: vendor/clang/dist/include/clang/Basic/Module.h ============================================================================== --- vendor/clang/dist/include/clang/Basic/Module.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/Module.h Wed Apr 26 19:24:09 2017 (r317447) @@ -62,6 +62,18 @@ public: /// \brief The location of the module definition. SourceLocation DefinitionLoc; + enum ModuleKind { + /// \brief This is a module that was defined by a module map and built out + /// of header files. + ModuleMapModule, + + /// \brief This is a C++ Modules TS module interface unit. + ModuleInterfaceUnit + }; + + /// \brief The kind of this module. + ModuleKind Kind = ModuleMapModule; + /// \brief The parent of this module. This will be NULL for the top-level /// module. Module *Parent; Modified: vendor/clang/dist/include/clang/Basic/Sanitizers.def ============================================================================== --- vendor/clang/dist/include/clang/Basic/Sanitizers.def Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/Sanitizers.def Wed Apr 26 19:24:09 2017 (r317447) @@ -47,6 +47,9 @@ SANITIZER("kernel-address", KernelAddres // MemorySanitizer SANITIZER("memory", Memory) +// libFuzzer +SANITIZER("fuzzer", Fuzzer) + // ThreadSanitizer SANITIZER("thread", Thread) Modified: vendor/clang/dist/include/clang/Driver/CC1Options.td ============================================================================== --- vendor/clang/dist/include/clang/Driver/CC1Options.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Driver/CC1Options.td Wed Apr 26 19:24:09 2017 (r317447) @@ -573,6 +573,8 @@ def fblocks_runtime_optional : Flag<["-" HelpText<"Weakly link in the blocks runtime">; def fexternc_nounwind : Flag<["-"], "fexternc-nounwind">, HelpText<"Assume all functions with C linkage do not unwind">; +def enable_split_dwarf : Flag<["-"], "enable-split-dwarf">, + HelpText<"Use split dwarf/Fission">; def split_dwarf_file : Separate<["-"], "split-dwarf-file">, HelpText<"File name to use for split dwarf debug info output">; def fno_wchar : Flag<["-"], "fno-wchar">, Modified: vendor/clang/dist/include/clang/Driver/SanitizerArgs.h ============================================================================== --- vendor/clang/dist/include/clang/Driver/SanitizerArgs.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Driver/SanitizerArgs.h Wed Apr 26 19:24:09 2017 (r317447) @@ -50,6 +50,7 @@ class SanitizerArgs { bool needsSharedAsanRt() const { return AsanSharedRuntime; } bool needsTsanRt() const { return Sanitizers.has(SanitizerKind::Thread); } bool needsMsanRt() const { return Sanitizers.has(SanitizerKind::Memory); } + bool needsFuzzer() const { return Sanitizers.has(SanitizerKind::Fuzzer); } bool needsLsanRt() const { return Sanitizers.has(SanitizerKind::Leak) && !Sanitizers.has(SanitizerKind::Address); Modified: vendor/clang/dist/include/clang/Format/Format.h ============================================================================== --- vendor/clang/dist/include/clang/Format/Format.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Format/Format.h Wed Apr 26 19:24:09 2017 (r317447) @@ -1512,6 +1512,18 @@ llvm::Expected cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style); +/// \brief Represents the status of a formatting attempt. +struct FormattingAttemptStatus { + /// \brief A value of ``false`` means that any of the affected ranges were not + /// formatted due to a non-recoverable syntax error. + bool FormatComplete = true; + + /// \brief If ``FormatComplete`` is false, ``Line`` records a one-based + /// original line number at which a syntax error might have occurred. This is + /// based on a best-effort analysis and could be imprecise. + unsigned Line = 0; +}; + /// \brief Reformats the given \p Ranges in \p Code. /// /// Each range is extended on either end to its next bigger logic unit, i.e. @@ -1521,13 +1533,20 @@ cleanupAroundReplacements(StringRef Code /// Returns the ``Replacements`` necessary to make all \p Ranges comply with /// \p Style. /// -/// If ``IncompleteFormat`` is non-null, its value will be set to true if any -/// of the affected ranges were not formatted due to a non-recoverable syntax -/// error. +/// If ``Status`` is non-null, its value will be populated with the status of +/// this formatting attempt. See \c FormattingAttemptStatus. tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, ArrayRef Ranges, StringRef FileName = "", - bool *IncompleteFormat = nullptr); + FormattingAttemptStatus *Status = nullptr); + +/// \brief Same as above, except if ``IncompleteFormat`` is non-null, its value +/// will be set to true if any of the affected ranges were not formatted due to +/// a non-recoverable syntax error. +tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, + ArrayRef Ranges, + StringRef FileName, + bool *IncompleteFormat); /// \brief Clean up any erroneous/redundant code in the given \p Ranges in \p /// Code. Modified: vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def ============================================================================== --- vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def Wed Apr 26 19:24:09 2017 (r317447) @@ -199,6 +199,7 @@ CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< CODEGENOPT(DebugExplicitImport, 1, 0) ///< Whether or not debug info should ///< contain explicit imports for ///< anonymous namespaces +CODEGENOPT(EnableSplitDwarf, 1, 0) ///< Whether to enable split DWARF CODEGENOPT(SplitDwarfInlining, 1, 1) ///< Whether to include inlining info in the ///< skeleton CU to allow for symbolication ///< of inline stack frames without .dwo files. Modified: vendor/clang/dist/include/clang/Index/IndexSymbol.h ============================================================================== --- vendor/clang/dist/include/clang/Index/IndexSymbol.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Index/IndexSymbol.h Wed Apr 26 19:24:09 2017 (r317447) @@ -59,6 +59,7 @@ enum class SymbolLanguage { C, ObjC, CXX, + Swift, }; /// Language specific sub-kinds. Modified: vendor/clang/dist/include/clang/Index/USRGeneration.h ============================================================================== --- vendor/clang/dist/include/clang/Index/USRGeneration.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Index/USRGeneration.h Wed Apr 26 19:24:09 2017 (r317447) @@ -30,10 +30,14 @@ static inline StringRef getUSRSpacePrefi bool generateUSRForDecl(const Decl *D, SmallVectorImpl &Buf); /// \brief Generate a USR fragment for an Objective-C class. -void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS); +void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = "", + StringRef CategoryContextExtSymbolDefinedIn = ""); /// \brief Generate a USR fragment for an Objective-C class category. -void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS); +void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS, + StringRef ClsExtSymbolDefinedIn = "", + StringRef CatExtSymbolDefinedIn = ""); /// \brief Generate a USR fragment for an Objective-C instance variable. The /// complete USR can be created by concatenating the USR for the @@ -48,7 +52,15 @@ void generateUSRForObjCMethod(StringRef void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS); /// \brief Generate a USR fragment for an Objective-C protocol. -void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS); +void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = ""); + +/// Generate USR fragment for a global (non-nested) enum. +void generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = ""); + +/// Generate a USR fragment for an enum constant. +void generateUSRForEnumConstant(StringRef EnumConstantName, raw_ostream &OS); /// \brief Generate a USR for a macro, including the USR prefix. /// Modified: vendor/clang/dist/include/clang/Sema/Sema.h ============================================================================== --- vendor/clang/dist/include/clang/Sema/Sema.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Sema/Sema.h Wed Apr 26 19:24:09 2017 (r317447) @@ -1934,7 +1934,8 @@ public: /// The parser has processed a module-declaration that begins the definition /// of a module interface or implementation. - DeclGroupPtrTy ActOnModuleDecl(SourceLocation ModuleLoc, ModuleDeclKind MDK, + DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc, + SourceLocation ModuleLoc, ModuleDeclKind MDK, ModuleIdPath Path); /// \brief The parser has processed a module import declaration. @@ -8326,6 +8327,12 @@ private: /// Returns OpenMP nesting level for current directive. unsigned getOpenMPNestingLevel() const; + /// Push new OpenMP function region for non-capturing function. + void pushOpenMPFunctionRegion(); + + /// Pop OpenMP function region for non-capturing function. + void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI); + /// Checks if a type or a declaration is disabled due to the owning extension /// being disabled, and emits diagnostic messages if it is disabled. /// \param D type or declaration to be checked. Modified: vendor/clang/dist/lib/AST/Comment.cpp ============================================================================== --- vendor/clang/dist/lib/AST/Comment.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/Comment.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -116,6 +116,9 @@ bool ParagraphComment::isWhitespaceNoCac static TypeLoc lookThroughTypedefOrTypeAliasLocs(TypeLoc &SrcTL) { TypeLoc TL = SrcTL.IgnoreParens(); + // Look through attribute types. + if (AttributedTypeLoc AttributeTL = TL.getAs()) + return AttributeTL.getModifiedLoc(); // Look through qualified types. if (QualifiedTypeLoc QualifiedTL = TL.getAs()) return QualifiedTL.getUnqualifiedLoc(); @@ -280,8 +283,25 @@ void DeclInfo::fill() { case Decl::EnumConstant: case Decl::ObjCIvar: case Decl::ObjCAtDefsField: + case Decl::ObjCProperty: { + const TypeSourceInfo *TSI; + if (const auto *VD = dyn_cast(CommentDecl)) + TSI = VD->getTypeSourceInfo(); + else if (const auto *PD = dyn_cast(CommentDecl)) + TSI = PD->getTypeSourceInfo(); + else + TSI = nullptr; + if (TSI) { + TypeLoc TL = TSI->getTypeLoc().getUnqualifiedLoc(); + FunctionTypeLoc FTL; + if (getFunctionTypeLoc(TL, FTL)) { + ParamVars = FTL.getParams(); + ReturnType = FTL.getReturnLoc().getType(); + } + } Kind = VariableKind; break; + } case Decl::Namespace: Kind = NamespaceKind; break; Modified: vendor/clang/dist/lib/AST/CommentSema.cpp ============================================================================== --- vendor/clang/dist/lib/AST/CommentSema.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/CommentSema.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -86,7 +86,7 @@ ParamCommandComment *Sema::actOnParamCom new (Allocator) ParamCommandComment(LocBegin, LocEnd, CommandID, CommandMarker); - if (!isFunctionDecl()) + if (!isFunctionDecl() && !isFunctionOrBlockPointerVarLikeDecl()) Diag(Command->getLocation(), diag::warn_doc_param_not_attached_to_a_function_decl) << CommandMarker @@ -584,7 +584,11 @@ void Sema::checkReturnsCommand(const Blo assert(ThisDeclInfo && "should not call this check on a bare comment"); - if (isFunctionDecl()) { + // We allow the return command for all @properties because it can be used + // to document the value that the property getter returns. + if (isObjCPropertyDecl()) + return; + if (isFunctionDecl() || isFunctionOrBlockPointerVarLikeDecl()) { if (ThisDeclInfo->ReturnType->isVoidType()) { unsigned DiagKind; switch (ThisDeclInfo->CommentDecl->getKind()) { @@ -610,8 +614,6 @@ void Sema::checkReturnsCommand(const Blo } return; } - else if (isObjCPropertyDecl()) - return; Diag(Command->getLocation(), diag::warn_doc_returns_not_attached_to_a_function_decl) @@ -844,6 +846,30 @@ bool Sema::isFunctionPointerVarDecl() { return false; } +bool Sema::isFunctionOrBlockPointerVarLikeDecl() { + if (!ThisDeclInfo) + return false; + if (!ThisDeclInfo->IsFilled) + inspectThisDecl(); + if (ThisDeclInfo->getKind() != DeclInfo::VariableKind || + !ThisDeclInfo->CurrentDecl) + return false; + QualType QT; + if (const auto *VD = dyn_cast(ThisDeclInfo->CurrentDecl)) + QT = VD->getType(); + else if (const auto *PD = + dyn_cast(ThisDeclInfo->CurrentDecl)) + QT = PD->getType(); + else + return false; + // We would like to warn about the 'returns'/'param' commands for + // variables that don't directly specify the function type, so type aliases + // can be ignored. + if (QT->getAs()) + return false; + return QT->isFunctionPointerType() || QT->isBlockPointerType(); +} + bool Sema::isObjCPropertyDecl() { if (!ThisDeclInfo) return false; Modified: vendor/clang/dist/lib/AST/Decl.cpp ============================================================================== --- vendor/clang/dist/lib/AST/Decl.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/Decl.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -2251,6 +2251,14 @@ bool VarDecl::checkInitIsICE() const { return Eval->IsICE; } +template +static DeclT *getDefinitionOrSelf(DeclT *D) { + assert(D); + if (auto *Def = D->getDefinition()) + return Def; + return D; +} + VarDecl *VarDecl::getTemplateInstantiationPattern() const { // If it's a variable template specialization, find the template or partial // specialization from which it was instantiated. @@ -2262,7 +2270,7 @@ VarDecl *VarDecl::getTemplateInstantiati break; VTD = NewVTD; } - return VTD->getTemplatedDecl()->getDefinition(); + return getDefinitionOrSelf(VTD->getTemplatedDecl()); } if (auto *VTPSD = From.dyn_cast()) { @@ -2271,7 +2279,7 @@ VarDecl *VarDecl::getTemplateInstantiati break; VTPSD = NewVTPSD; } - return VTPSD->getDefinition(); + return getDefinitionOrSelf(VTPSD); } } @@ -2280,23 +2288,18 @@ VarDecl *VarDecl::getTemplateInstantiati VarDecl *VD = getInstantiatedFromStaticDataMember(); while (auto *NewVD = VD->getInstantiatedFromStaticDataMember()) VD = NewVD; - return VD->getDefinition(); + return getDefinitionOrSelf(VD); } } if (VarTemplateDecl *VarTemplate = getDescribedVarTemplate()) { - while (VarTemplate->getInstantiatedFromMemberTemplate()) { if (VarTemplate->isMemberSpecialization()) break; VarTemplate = VarTemplate->getInstantiatedFromMemberTemplate(); } - assert((!VarTemplate->getTemplatedDecl() || - !isTemplateInstantiation(getTemplateSpecializationKind())) && - "couldn't find pattern for variable instantiation"); - - return VarTemplate->getTemplatedDecl(); + return getDefinitionOrSelf(VarTemplate->getTemplatedDecl()); } return nullptr; } @@ -3198,9 +3201,12 @@ bool FunctionDecl::isTemplateInstantiati FunctionDecl *FunctionDecl::getTemplateInstantiationPattern() const { // Handle class scope explicit specialization special case. - if (getTemplateSpecializationKind() == TSK_ExplicitSpecialization) - return getClassScopeSpecializationPattern(); - + if (getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { + if (auto *Spec = getClassScopeSpecializationPattern()) + return getDefinitionOrSelf(Spec); + return nullptr; + } + // If this is a generic lambda call operator specialization, its // instantiation pattern is always its primary template's pattern // even if its primary template was instantiated from another @@ -3212,16 +3218,10 @@ FunctionDecl *FunctionDecl::getTemplateI if (isGenericLambdaCallOperatorSpecialization( dyn_cast(this))) { - assert(getPrimaryTemplate() && "A generic lambda specialization must be " - "generated from a primary call operator " - "template"); - assert(getPrimaryTemplate()->getTemplatedDecl()->getBody() && - "A generic lambda call operator template must always have a body - " - "even if instantiated from a prototype (i.e. as written) member " - "template"); - return getPrimaryTemplate()->getTemplatedDecl(); + assert(getPrimaryTemplate() && "not a generic lambda call operator?"); + return getDefinitionOrSelf(getPrimaryTemplate()->getTemplatedDecl()); } - + if (FunctionTemplateDecl *Primary = getPrimaryTemplate()) { while (Primary->getInstantiatedFromMemberTemplate()) { // If we have hit a point where the user provided a specialization of @@ -3230,11 +3230,14 @@ FunctionDecl *FunctionDecl::getTemplateI break; Primary = Primary->getInstantiatedFromMemberTemplate(); } - - return Primary->getTemplatedDecl(); + + return getDefinitionOrSelf(Primary->getTemplatedDecl()); } - - return getInstantiatedFromMemberFunction(); + + if (auto *MFD = getInstantiatedFromMemberFunction()) + return getDefinitionOrSelf(MFD); + + return nullptr; } FunctionTemplateDecl *FunctionDecl::getPrimaryTemplate() const { @@ -3778,7 +3781,7 @@ EnumDecl *EnumDecl::getTemplateInstantia EnumDecl *ED = getInstantiatedFromMemberEnum(); while (auto *NewED = ED->getInstantiatedFromMemberEnum()) ED = NewED; - return ED; + return getDefinitionOrSelf(ED); } } Modified: vendor/clang/dist/lib/AST/DeclCXX.cpp ============================================================================== --- vendor/clang/dist/lib/AST/DeclCXX.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/DeclCXX.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -1364,6 +1364,13 @@ CXXRecordDecl::setTemplateSpecialization } const CXXRecordDecl *CXXRecordDecl::getTemplateInstantiationPattern() const { + auto GetDefinitionOrSelf = + [](const CXXRecordDecl *D) -> const CXXRecordDecl * { + if (auto *Def = D->getDefinition()) + return Def; + return D; + }; + // If it's a class template specialization, find the template or partial // specialization from which it was instantiated. if (auto *TD = dyn_cast(this)) { @@ -1374,7 +1381,7 @@ const CXXRecordDecl *CXXRecordDecl::getT break; CTD = NewCTD; } - return CTD->getTemplatedDecl()->getDefinition(); + return GetDefinitionOrSelf(CTD->getTemplatedDecl()); } if (auto *CTPSD = From.dyn_cast()) { @@ -1383,7 +1390,7 @@ const CXXRecordDecl *CXXRecordDecl::getT break; CTPSD = NewCTPSD; } - return CTPSD->getDefinition(); + return GetDefinitionOrSelf(CTPSD); } } @@ -1392,7 +1399,7 @@ const CXXRecordDecl *CXXRecordDecl::getT const CXXRecordDecl *RD = this; while (auto *NewRD = RD->getInstantiatedFromMemberClass()) RD = NewRD; - return RD->getDefinition(); + return GetDefinitionOrSelf(RD); } } Modified: vendor/clang/dist/lib/AST/DeclObjC.cpp ============================================================================== --- vendor/clang/dist/lib/AST/DeclObjC.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/DeclObjC.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -539,9 +539,18 @@ void ObjCInterfaceDecl::getDesignatedIni bool ObjCInterfaceDecl::isDesignatedInitializer(Selector Sel, const ObjCMethodDecl **InitMethod) const { + bool HasCompleteDef = isThisDeclarationADefinition(); + // During deserialization the data record for the ObjCInterfaceDecl could + // be made invariant by reusing the canonical decl. Take this into account + // when checking for the complete definition. + if (!HasCompleteDef && getCanonicalDecl()->hasDefinition() && + getCanonicalDecl()->getDefinition() == getDefinition()) + HasCompleteDef = true; + // Check for a complete definition and recover if not so. - if (!isThisDeclarationADefinition()) + if (!HasCompleteDef) return false; + if (data().ExternallyCompleted) LoadExternalDefinition(); Modified: vendor/clang/dist/lib/CodeGen/BackendUtil.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/BackendUtil.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/BackendUtil.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -129,16 +129,20 @@ public: // that we add to the PassManagerBuilder. class PassManagerBuilderWrapper : public PassManagerBuilder { public: - PassManagerBuilderWrapper(const CodeGenOptions &CGOpts, + PassManagerBuilderWrapper(const Triple &TargetTriple, + const CodeGenOptions &CGOpts, const LangOptions &LangOpts) - : PassManagerBuilder(), CGOpts(CGOpts), LangOpts(LangOpts) {} + : PassManagerBuilder(), TargetTriple(TargetTriple), CGOpts(CGOpts), + LangOpts(LangOpts) {} + const Triple &getTargetTriple() const { return TargetTriple; } const CodeGenOptions &getCGOpts() const { return CGOpts; } const LangOptions &getLangOpts() const { return LangOpts; } + private: + const Triple &TargetTriple; const CodeGenOptions &CGOpts; const LangOptions &LangOpts; }; - } static void addObjCARCAPElimPass(const PassManagerBuilder &Builder, PassManagerBase &PM) { @@ -185,16 +189,35 @@ static void addSanitizerCoveragePass(con PM.add(createSanitizerCoverageModulePass(Opts)); } +// Check if ASan should use GC-friendly instrumentation for globals. +// First of all, there is no point if -fdata-sections is off (expect for MachO, +// where this is not a factor). Also, on ELF this feature requires an assembler +// extension that only works with -integrated-as at the moment. +static bool asanUseGlobalsGC(const Triple &T, const CodeGenOptions &CGOpts) { + switch (T.getObjectFormat()) { + case Triple::MachO: + case Triple::COFF: + return true; + case Triple::ELF: + return CGOpts.DataSections && !CGOpts.DisableIntegratedAS; + default: + return false; + } +} + static void addAddressSanitizerPasses(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { const PassManagerBuilderWrapper &BuilderWrapper = static_cast(Builder); + const Triple &T = BuilderWrapper.getTargetTriple(); const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts(); bool Recover = CGOpts.SanitizeRecover.has(SanitizerKind::Address); bool UseAfterScope = CGOpts.SanitizeAddressUseAfterScope; + bool UseGlobalsGC = asanUseGlobalsGC(T, CGOpts); PM.add(createAddressSanitizerFunctionPass(/*CompileKernel*/ false, Recover, UseAfterScope)); - PM.add(createAddressSanitizerModulePass(/*CompileKernel*/false, Recover)); + PM.add(createAddressSanitizerModulePass(/*CompileKernel*/ false, Recover, + UseGlobalsGC)); } static void addKernelAddressSanitizerPasses(const PassManagerBuilder &Builder, @@ -407,6 +430,8 @@ static void initTargetOptions(llvm::Targ Options.EmulatedTLS = CodeGenOpts.EmulatedTLS; Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning(); + if (CodeGenOpts.EnableSplitDwarf) + Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile; Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll; Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels; Options.MCOptions.MCUseDwarfDirectory = !CodeGenOpts.NoDwarfDirectoryAsm; @@ -434,8 +459,6 @@ void EmitAssemblyHelper::CreatePasses(le if (CodeGenOpts.DisableLLVMPasses) return; - PassManagerBuilderWrapper PMBuilder(CodeGenOpts, LangOpts); - // Figure out TargetLibraryInfo. This needs to be added to MPM and FPM // manually (and not via PMBuilder), since some passes (eg. InstrProfiling) // are inserted before PMBuilder ones - they'd get the default-constructed @@ -444,6 +467,8 @@ void EmitAssemblyHelper::CreatePasses(le std::unique_ptr TLII( createTLII(TargetTriple, CodeGenOpts)); + PassManagerBuilderWrapper PMBuilder(TargetTriple, CodeGenOpts, LangOpts); + // At O0 and O1 we only run the always inliner which is more efficient. At // higher optimization levels we run the normal inliner. if (CodeGenOpts.OptimizationLevel <= 1) { Modified: vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -528,12 +528,14 @@ void CGDebugInfo::CreateCompileUnit() { // Create new compile unit. // FIXME - Eliminate TheCU. TheCU = DBuilder.createCompileUnit( - LangTag, DBuilder.createFile(remapDIPath(MainFileName), - remapDIPath(getCurrentDirname()), CSKind, - Checksum), + LangTag, + DBuilder.createFile(remapDIPath(MainFileName), + remapDIPath(getCurrentDirname()), CSKind, Checksum), Producer, LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers, - CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */, - CGM.getCodeGenOpts().SplitDwarfInlining, + CGM.getCodeGenOpts().EnableSplitDwarf + ? "" + : CGM.getCodeGenOpts().SplitDwarfFile, + EmissionKind, 0 /* DWOid */, CGM.getCodeGenOpts().SplitDwarfInlining, CGM.getCodeGenOpts().DebugInfoForProfiling); } Modified: vendor/clang/dist/lib/CodeGen/CGExpr.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGExpr.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGExpr.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -533,15 +533,6 @@ bool CodeGenFunction::sanitizePerformTyp SanOpts.has(SanitizerKind::Vptr); } -/// Check if a runtime null check for \p Ptr can be omitted. -static bool canOmitPointerNullCheck(llvm::Value *Ptr) { - // Note: do not perform any constant-folding in this function. That is best - // left to the IR builder. - - // Pointers to alloca'd memory are non-null. - return isa(Ptr->stripPointerCastsNoFollowAliases()); -} - void CodeGenFunction::EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, llvm::Value *Ptr, QualType Ty, CharUnits Alignment, @@ -560,11 +551,16 @@ void CodeGenFunction::EmitTypeCheck(Type SmallVector, 3> Checks; llvm::BasicBlock *Done = nullptr; + // Quickly determine whether we have a pointer to an alloca. It's possible + // to skip null checks, and some alignment checks, for these pointers. This + // can reduce compile-time significantly. + auto PtrToAlloca = + dyn_cast(Ptr->stripPointerCastsNoFollowAliases()); + bool AllowNullPointers = TCK == TCK_DowncastPointer || TCK == TCK_Upcast || TCK == TCK_UpcastToVirtualBase; if ((SanOpts.has(SanitizerKind::Null) || AllowNullPointers) && - !SkippedChecks.has(SanitizerKind::Null) && - !canOmitPointerNullCheck(Ptr)) { + !SkippedChecks.has(SanitizerKind::Null) && !PtrToAlloca) { // The glvalue must not be an empty glvalue. llvm::Value *IsNonNull = Builder.CreateIsNotNull(Ptr); @@ -617,7 +613,8 @@ void CodeGenFunction::EmitTypeCheck(Type AlignVal = getContext().getTypeAlignInChars(Ty).getQuantity(); // The glvalue must be suitably aligned. - if (AlignVal > 1) { + if (AlignVal > 1 && + (!PtrToAlloca || PtrToAlloca->getAlignment() < AlignVal)) { llvm::Value *Align = Builder.CreateAnd(Builder.CreatePtrToInt(Ptr, IntPtrTy), llvm::ConstantInt::get(IntPtrTy, AlignVal - 1)); Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -2466,16 +2466,14 @@ static int addMonoNonMonoModifier(OpenMP return Schedule | Modifier; } -void CGOpenMPRuntime::emitForDispatchInit(CodeGenFunction &CGF, - SourceLocation Loc, - const OpenMPScheduleTy &ScheduleKind, - unsigned IVSize, bool IVSigned, - bool Ordered, llvm::Value *UB, - llvm::Value *Chunk) { +void CGOpenMPRuntime::emitForDispatchInit( + CodeGenFunction &CGF, SourceLocation Loc, + const OpenMPScheduleTy &ScheduleKind, unsigned IVSize, bool IVSigned, + bool Ordered, const DispatchRTInput &DispatchValues) { if (!CGF.HaveInsertPoint()) return; - OpenMPSchedType Schedule = - getRuntimeSchedule(ScheduleKind.Schedule, Chunk != nullptr, Ordered); + OpenMPSchedType Schedule = getRuntimeSchedule( + ScheduleKind.Schedule, DispatchValues.Chunk != nullptr, Ordered); assert(Ordered || (Schedule != OMP_sch_static && Schedule != OMP_sch_static_chunked && Schedule != OMP_ord_static && Schedule != OMP_ord_static_chunked && @@ -2486,14 +2484,14 @@ void CGOpenMPRuntime::emitForDispatchIni // kmp_int[32|64] stride, kmp_int[32|64] chunk); // If the Chunk was not specified in the clause - use default value 1. - if (Chunk == nullptr) - Chunk = CGF.Builder.getIntN(IVSize, 1); + llvm::Value *Chunk = DispatchValues.Chunk ? DispatchValues.Chunk + : CGF.Builder.getIntN(IVSize, 1); llvm::Value *Args[] = { emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc), CGF.Builder.getInt32(addMonoNonMonoModifier( Schedule, ScheduleKind.M1, ScheduleKind.M2)), // Schedule type - CGF.Builder.getIntN(IVSize, 0), // Lower - UB, // Upper + DispatchValues.LB, // Lower + DispatchValues.UB, // Upper CGF.Builder.getIntN(IVSize, 1), // Stride Chunk // Chunk }; Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h Wed Apr 26 19:24:09 2017 (r317447) @@ -672,16 +672,50 @@ public: /// virtual bool isDynamic(OpenMPScheduleClauseKind ScheduleKind) const; + /// struct with the values to be passed to the dispatch runtime function + struct DispatchRTInput { + /// Loop lower bound + llvm::Value *LB = nullptr; + /// Loop upper bound + llvm::Value *UB = nullptr; + /// Chunk size specified using 'schedule' clause (nullptr if chunk + /// was not specified) + llvm::Value *Chunk = nullptr; + DispatchRTInput() = default; + DispatchRTInput(llvm::Value *LB, llvm::Value *UB, llvm::Value *Chunk) + : LB(LB), UB(UB), Chunk(Chunk) {} + }; + + /// Call the appropriate runtime routine to initialize it before start + /// of loop. + + /// This is used for non static scheduled types and when the ordered + /// clause is present on the loop construct. + /// Depending on the loop schedule, it is necessary to call some runtime + /// routine before start of the OpenMP loop to get the loop upper / lower + /// bounds \a LB and \a UB and stride \a ST. + /// + /// \param CGF Reference to current CodeGenFunction. + /// \param Loc Clang source location. + /// \param ScheduleKind Schedule kind, specified by the 'schedule' clause. + /// \param IVSize Size of the iteration variable in bits. + /// \param IVSigned Sign of the interation variable. + /// \param Ordered true if loop is ordered, false otherwise. + /// \param DispatchValues struct containing llvm values for lower bound, upper + /// bound, and chunk expression. + /// For the default (nullptr) value, the chunk 1 will be used. + /// virtual void emitForDispatchInit(CodeGenFunction &CGF, SourceLocation Loc, const OpenMPScheduleTy &ScheduleKind, unsigned IVSize, bool IVSigned, bool Ordered, - llvm::Value *UB, - llvm::Value *Chunk = nullptr); + const DispatchRTInput &DispatchValues); /// \brief Call the appropriate runtime routine to initialize it before start /// of loop. /// - /// Depending on the loop schedule, it is nesessary to call some runtime + /// This is used only in case of static schedule, when the user did not + /// specify a ordered clause on the loop construct. + /// Depending on the loop schedule, it is necessary to call some runtime /// routine before start of the OpenMP loop to get the loop upper / lower /// bounds \a LB and \a UB and stride \a ST. /// Modified: vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -87,7 +87,8 @@ public: class OMPParallelScope final : public OMPLexicalScope { bool EmitPreInitStmt(const OMPExecutableDirective &S) { OpenMPDirectiveKind Kind = S.getDirectiveKind(); - return !isOpenMPTargetExecutionDirective(Kind) && + return !(isOpenMPTargetExecutionDirective(Kind) || + isOpenMPLoopBoundSharingDirective(Kind)) && isOpenMPParallelDirective(Kind); } @@ -1249,10 +1250,20 @@ static void emitPostUpdateForReductionCl CGF.EmitBlock(DoneBB, /*IsFinished=*/true); } -static void emitCommonOMPParallelDirective(CodeGenFunction &CGF, - const OMPExecutableDirective &S, - OpenMPDirectiveKind InnermostKind, - const RegionCodeGenTy &CodeGen) { +namespace { +/// Codegen lambda for appending distribute lower and upper bounds to outlined +/// parallel function. This is necessary for combined constructs such as +/// 'distribute parallel for' +typedef llvm::function_ref &)> + CodeGenBoundParametersTy; +} // anonymous namespace + +static void emitCommonOMPParallelDirective( + CodeGenFunction &CGF, const OMPExecutableDirective &S, + OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, + const CodeGenBoundParametersTy &CodeGenBoundParameters) { const CapturedStmt *CS = S.getCapturedStmt(OMPD_parallel); auto OutlinedFn = CGF.CGM.getOpenMPRuntime().emitParallelOutlinedFunction( S, *CS->getCapturedDecl()->param_begin(), InnermostKind, CodeGen); @@ -1279,11 +1290,20 @@ static void emitCommonOMPParallelDirecti OMPParallelScope Scope(CGF, S); llvm::SmallVector CapturedVars; + // Combining 'distribute' with 'for' requires sharing each 'distribute' chunk + // lower and upper bounds with the pragma 'for' chunking mechanism. + // The following lambda takes care of appending the lower and upper bound + // parameters when necessary + CodeGenBoundParameters(CGF, S, CapturedVars); CGF.GenerateOpenMPCapturedVars(*CS, CapturedVars); CGF.CGM.getOpenMPRuntime().emitParallelCall(CGF, S.getLocStart(), OutlinedFn, CapturedVars, IfCond); } +static void emitEmptyBoundParameters(CodeGenFunction &, + const OMPExecutableDirective &, + llvm::SmallVectorImpl &) {} + void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) { // Emit parallel region as a standalone region. auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) { @@ -1304,7 +1324,8 @@ void CodeGenFunction::EmitOMPParallelDir CGF.EmitStmt(cast(S.getAssociatedStmt())->getCapturedStmt()); CGF.EmitOMPReductionClauseFinal(S, /*ReductionKind=*/OMPD_parallel); }; - emitCommonOMPParallelDirective(*this, S, OMPD_parallel, CodeGen); + emitCommonOMPParallelDirective(*this, S, OMPD_parallel, CodeGen, + emitEmptyBoundParameters); emitPostUpdateForReductionClause( *this, S, [](CodeGenFunction &) -> llvm::Value * { return nullptr; }); } @@ -1649,6 +1670,13 @@ void CodeGenFunction::EmitOMPSimdFinal( EmitBlock(DoneBB, /*IsFinished=*/true); } +static void emitOMPLoopBodyWithStopPoint(CodeGenFunction &CGF, + const OMPLoopDirective &S, + CodeGenFunction::JumpDest LoopExit) { + CGF.EmitOMPLoopBody(S, LoopExit); + CGF.EmitStopPoint(&S); +}; + void CodeGenFunction::EmitOMPSimdDirective(const OMPSimdDirective &S) { auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) { OMPLoopScope PreInitScope(CGF, S); @@ -1731,9 +1759,12 @@ void CodeGenFunction::EmitOMPSimdDirecti CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_simd, CodeGen); } -void CodeGenFunction::EmitOMPOuterLoop(bool DynamicOrOrdered, bool IsMonotonic, - const OMPLoopDirective &S, OMPPrivateScope &LoopScope, bool Ordered, - Address LB, Address UB, Address ST, Address IL, llvm::Value *Chunk) { +void CodeGenFunction::EmitOMPOuterLoop( + bool DynamicOrOrdered, bool IsMonotonic, const OMPLoopDirective &S, + CodeGenFunction::OMPPrivateScope &LoopScope, + const CodeGenFunction::OMPLoopArguments &LoopArgs, + const CodeGenFunction::CodeGenLoopTy &CodeGenLoop, + const CodeGenFunction::CodeGenOrderedTy &CodeGenOrdered) { auto &RT = CGM.getOpenMPRuntime(); const Expr *IVExpr = S.getIterationVariable(); @@ -1751,15 +1782,18 @@ void CodeGenFunction::EmitOMPOuterLoop(b llvm::Value *BoolCondVal = nullptr; if (!DynamicOrOrdered) { - // UB = min(UB, GlobalUB) - EmitIgnoredExpr(S.getEnsureUpperBound()); + // UB = min(UB, GlobalUB) or + // UB = min(UB, PrevUB) for combined loop sharing constructs (e.g. + // 'distribute parallel for') + EmitIgnoredExpr(LoopArgs.EUB); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Wed Apr 26 19:24:24 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87330D51C35; Wed, 26 Apr 2017 19:24:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24952923; Wed, 26 Apr 2017 19:24:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QJONpq030384; Wed, 26 Apr 2017 19:24:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJOK7A030358; Wed, 26 Apr 2017 19:24:20 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJOK7A030358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317449 - in vendor/compiler-rt/dist: include/sanitizer lib/builtins lib/lsan lib/sanitizer_common lib/scudo lib/tsan/rtl test test/asan/TestCases/Linux test/asan/TestCases/Posix test/a... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:24 -0000 Author: dim Date: Wed Apr 26 19:24:20 2017 New Revision: 317449 URL: https://svnweb.freebsd.org/changeset/base/317449 Log: Vendor import of compiler-rt trunk r301441: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301441 Added: vendor/compiler-rt/dist/test/asan/TestCases/Linux/textdomain.c (contents, props changed) vendor/compiler-rt/dist/test/cfi/cross-dso/icall/dlopen.cpp (contents, props changed) vendor/compiler-rt/dist/test/tsan/Darwin/deadlock.mm vendor/compiler-rt/dist/test/tsan/Darwin/external-dups.cc (contents, props changed) vendor/compiler-rt/dist/test/tsan/Darwin/external-ignore-noninstrumented.cc (contents, props changed) vendor/compiler-rt/dist/test/tsan/Darwin/external-lib.cc (contents, props changed) vendor/compiler-rt/dist/test/tsan/Darwin/external-noninstrumented-module.cc (contents, props changed) Deleted: vendor/compiler-rt/dist/test/cfi/cross-dso/dlopen.cpp Modified: vendor/compiler-rt/dist/include/sanitizer/tsan_interface.h vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt vendor/compiler-rt/dist/lib/builtins/emutls.c vendor/compiler-rt/dist/lib/lsan/lsan_allocator.h vendor/compiler-rt/dist/lib/lsan/lsan_common.cc vendor/compiler-rt/dist/lib/lsan/lsan_common.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_local_cache.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.h vendor/compiler-rt/dist/lib/scudo/scudo_allocator.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_external.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.h vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.h vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cc vendor/compiler-rt/dist/test/CMakeLists.txt vendor/compiler-rt/dist/test/asan/TestCases/Linux/read_binary_name_regtest.c vendor/compiler-rt/dist/test/asan/TestCases/Posix/strchr.c vendor/compiler-rt/dist/test/asan/TestCases/Windows/dll_global_dead_strip.c vendor/compiler-rt/dist/test/asan/TestCases/Windows/fuse-lld.cc vendor/compiler-rt/dist/test/asan/TestCases/Windows/global_dead_strip.c vendor/compiler-rt/dist/test/asan/android_commands/android_run.py vendor/compiler-rt/dist/test/cfi/CMakeLists.txt vendor/compiler-rt/dist/test/cfi/create-derivers.test vendor/compiler-rt/dist/test/cfi/cross-dso/icall/lit.local.cfg vendor/compiler-rt/dist/test/cfi/cross-dso/stats.cpp vendor/compiler-rt/dist/test/cfi/icall/lit.local.cfg vendor/compiler-rt/dist/test/cfi/lit.cfg vendor/compiler-rt/dist/test/cfi/lit.site.cfg.in vendor/compiler-rt/dist/test/lit.common.cfg vendor/compiler-rt/dist/test/lit.common.configured.in vendor/compiler-rt/dist/test/lsan/lit.common.cfg vendor/compiler-rt/dist/test/safestack/lit.cfg vendor/compiler-rt/dist/test/tsan/Darwin/debug_external.cc vendor/compiler-rt/dist/test/tsan/Darwin/external.cc vendor/compiler-rt/dist/test/tsan/test.h vendor/compiler-rt/dist/test/tsan/unaligned_race.cc Modified: vendor/compiler-rt/dist/include/sanitizer/tsan_interface.h ============================================================================== --- vendor/compiler-rt/dist/include/sanitizer/tsan_interface.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/include/sanitizer/tsan_interface.h Wed Apr 26 19:24:20 2017 (r317449) @@ -114,6 +114,21 @@ void __tsan_mutex_post_signal(void *addr void __tsan_mutex_pre_divert(void *addr, unsigned flags); void __tsan_mutex_post_divert(void *addr, unsigned flags); +// External race detection API. +// Can be used by non-instrumented libraries to detect when their objects are +// being used in an unsafe manner. +// - __tsan_external_read/__tsan_external_write annotates the logical reads +// and writes of the object at the specified address. 'caller_pc' should +// be the PC of the library user, which the library can obtain with e.g. +// `__builtin_return_address(0)`. +// - __tsan_external_register_tag registers a 'tag' with the specified name, +// which is later used in read/write annotations to denote the object type +// - __tsan_external_assign_tag can optionally mark a heap object with a tag +void *__tsan_external_register_tag(const char *object_type); +void __tsan_external_assign_tag(void *addr, void *tag); +void __tsan_external_read(void *addr, void *caller_pc, void *tag); +void __tsan_external_write(void *addr, void *caller_pc, void *tag); + #ifdef __cplusplus } // extern "C" #endif Modified: vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt ============================================================================== --- vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt Wed Apr 26 19:24:20 2017 (r317449) @@ -164,7 +164,8 @@ set(GENERIC_SOURCES udivti3.c umoddi3.c umodsi3.c - umodti3.c) + umodti3.c + emutls.c) option(COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN "Skip the atomic builtin (this may be needed if system headers are unavailable)" @@ -187,12 +188,6 @@ if(APPLE) atomic_thread_fence.c) endif() -if(NOT WIN32 OR MINGW) - set(GENERIC_SOURCES - ${GENERIC_SOURCES} - emutls.c) -endif() - if (HAVE_UNWIND_H) set(GENERIC_SOURCES ${GENERIC_SOURCES} Modified: vendor/compiler-rt/dist/lib/builtins/emutls.c ============================================================================== --- vendor/compiler-rt/dist/lib/builtins/emutls.c Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/builtins/emutls.c Wed Apr 26 19:24:20 2017 (r317449) @@ -7,7 +7,6 @@ * * ===----------------------------------------------------------------------=== */ -#include #include #include #include @@ -15,6 +14,23 @@ #include "int_lib.h" #include "int_util.h" +typedef struct emutls_address_array { + uintptr_t size; /* number of elements in the 'data' array */ + void* data[]; +} emutls_address_array; + +static void emutls_shutdown(emutls_address_array *array); + +#ifndef _WIN32 + +#include + +static pthread_mutex_t emutls_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_key_t emutls_pthread_key; + +typedef unsigned int gcc_word __attribute__((mode(word))); +typedef unsigned int gcc_pointer __attribute__((mode(pointer))); + /* Default is not to use posix_memalign, so systems like Android * can use thread local data without heavier POSIX memory allocators. */ @@ -22,26 +38,6 @@ #define EMUTLS_USE_POSIX_MEMALIGN 0 #endif -/* For every TLS variable xyz, - * there is one __emutls_control variable named __emutls_v.xyz. - * If xyz has non-zero initial value, __emutls_v.xyz's "value" - * will point to __emutls_t.xyz, which has the initial value. - */ -typedef unsigned int gcc_word __attribute__((mode(word))); -typedef struct __emutls_control { - /* Must use gcc_word here, instead of size_t, to match GCC. When - gcc_word is larger than size_t, the upper extra bits are all - zeros. We can use variables of size_t to operate on size and - align. */ - gcc_word size; /* size of the object in bytes */ - gcc_word align; /* alignment of the object in bytes */ - union { - uintptr_t index; /* data[index-1] is the object address */ - void* address; /* object address, when in single thread env */ - } object; - void* value; /* null or non-zero initial value for the object */ -} __emutls_control; - static __inline void *emutls_memalign_alloc(size_t align, size_t size) { void *base; #if EMUTLS_USE_POSIX_MEMALIGN @@ -50,7 +46,7 @@ static __inline void *emutls_memalign_al #else #define EXTRA_ALIGN_PTR_BYTES (align - 1 + sizeof(void*)) char* object; - if ((object = malloc(EXTRA_ALIGN_PTR_BYTES + size)) == NULL) + if ((object = (char*)malloc(EXTRA_ALIGN_PTR_BYTES + size)) == NULL) abort(); base = (void*)(((uintptr_t)(object + EXTRA_ALIGN_PTR_BYTES)) & ~(uintptr_t)(align - 1)); @@ -69,10 +65,207 @@ static __inline void emutls_memalign_fre #endif } +static void emutls_key_destructor(void* ptr) { + emutls_shutdown((emutls_address_array*)ptr); + free(ptr); +} + +static __inline void emutls_init(void) { + if (pthread_key_create(&emutls_pthread_key, emutls_key_destructor) != 0) + abort(); +} + +static __inline void emutls_init_once(void) { + static pthread_once_t once = PTHREAD_ONCE_INIT; + pthread_once(&once, emutls_init); +} + +static __inline void emutls_lock() { + pthread_mutex_lock(&emutls_mutex); +} + +static __inline void emutls_unlock() { + pthread_mutex_unlock(&emutls_mutex); +} + +static __inline void emutls_setspecific(emutls_address_array *value) { + pthread_setspecific(emutls_pthread_key, (void*) value); +} + +static __inline emutls_address_array* emutls_getspecific() { + return (emutls_address_array*) pthread_getspecific(emutls_pthread_key); +} + +#else + +#include +#include +#include +#include +#include + +static LPCRITICAL_SECTION emutls_mutex; +static DWORD emutls_tls_index = TLS_OUT_OF_INDEXES; + +typedef uintptr_t gcc_word; +typedef void * gcc_pointer; + +static void win_error(DWORD last_err, const char *hint) { + char *buffer = NULL; + if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_MAX_WIDTH_MASK, + NULL, last_err, 0, (LPSTR)&buffer, 1, NULL)) { + fprintf(stderr, "Windows error: %s\n", buffer); + } else { + fprintf(stderr, "Unkown Windows error: %s\n", hint); + } + LocalFree(buffer); +} + +static __inline void win_abort(DWORD last_err, const char *hint) { + win_error(last_err, hint); + abort(); +} + +static __inline void *emutls_memalign_alloc(size_t align, size_t size) { + void *base = _aligned_malloc(size, align); + if (!base) + win_abort(GetLastError(), "_aligned_malloc"); + return base; +} + +static __inline void emutls_memalign_free(void *base) { + _aligned_free(base); +} + +static void emutls_exit(void) { + if (emutls_mutex) { + DeleteCriticalSection(emutls_mutex); + _aligned_free(emutls_mutex); + emutls_mutex = NULL; + } + if (emutls_tls_index != TLS_OUT_OF_INDEXES) { + emutls_shutdown((emutls_address_array*)TlsGetValue(emutls_tls_index)); + TlsFree(emutls_tls_index); + emutls_tls_index = TLS_OUT_OF_INDEXES; + } +} + +#pragma warning (push) +#pragma warning (disable : 4100) +static BOOL CALLBACK emutls_init(PINIT_ONCE p0, PVOID p1, PVOID *p2) { + emutls_mutex = (LPCRITICAL_SECTION)_aligned_malloc(sizeof(CRITICAL_SECTION), 16); + if (!emutls_mutex) { + win_error(GetLastError(), "_aligned_malloc"); + return FALSE; + } + InitializeCriticalSection(emutls_mutex); + + emutls_tls_index = TlsAlloc(); + if (emutls_tls_index == TLS_OUT_OF_INDEXES) { + emutls_exit(); + win_error(GetLastError(), "TlsAlloc"); + return FALSE; + } + atexit(&emutls_exit); + return TRUE; +} + +static __inline void emutls_init_once(void) { + static INIT_ONCE once; + InitOnceExecuteOnce(&once, emutls_init, NULL, NULL); +} + +static __inline void emutls_lock() { + EnterCriticalSection(emutls_mutex); +} + +static __inline void emutls_unlock() { + LeaveCriticalSection(emutls_mutex); +} + +static __inline void emutls_setspecific(emutls_address_array *value) { + if (TlsSetValue(emutls_tls_index, (LPVOID) value) == 0) + win_abort(GetLastError(), "TlsSetValue"); +} + +static __inline emutls_address_array* emutls_getspecific() { + LPVOID value = TlsGetValue(emutls_tls_index); + if (value == NULL) { + const DWORD err = GetLastError(); + if (err != ERROR_SUCCESS) + win_abort(err, "TlsGetValue"); + } + return (emutls_address_array*) value; +} + +/* Provide atomic load/store functions for emutls_get_index if built with MSVC. + */ +#if !defined(__ATOMIC_RELEASE) + +enum { __ATOMIC_ACQUIRE = 2, __ATOMIC_RELEASE = 3 }; + +static __inline uintptr_t __atomic_load_n(void *ptr, unsigned type) { + assert(type == __ATOMIC_ACQUIRE); +#ifdef _WIN64 + return (uintptr_t) _load_be_u64(ptr); +#else + return (uintptr_t) _load_be_u32(ptr); +#endif +} + +static __inline void __atomic_store_n(void *ptr, uintptr_t val, unsigned type) { + assert(type == __ATOMIC_RELEASE); +#ifdef _WIN64 + _store_be_u64(ptr, val); +#else + _store_be_u32(ptr, val); +#endif +} + +#endif + +#pragma warning (pop) + +#endif + +static size_t emutls_num_object = 0; /* number of allocated TLS objects */ + +/* Free the allocated TLS data + */ +static void emutls_shutdown(emutls_address_array *array) { + if (array) { + uintptr_t i; + for (i = 0; i < array->size; ++i) { + if (array->data[i]) + emutls_memalign_free(array->data[i]); + } + } +} + +/* For every TLS variable xyz, + * there is one __emutls_control variable named __emutls_v.xyz. + * If xyz has non-zero initial value, __emutls_v.xyz's "value" + * will point to __emutls_t.xyz, which has the initial value. + */ +typedef struct __emutls_control { + /* Must use gcc_word here, instead of size_t, to match GCC. When + gcc_word is larger than size_t, the upper extra bits are all + zeros. We can use variables of size_t to operate on size and + align. */ + gcc_word size; /* size of the object in bytes */ + gcc_word align; /* alignment of the object in bytes */ + union { + uintptr_t index; /* data[index-1] is the object address */ + void* address; /* object address, when in single thread env */ + } object; + void* value; /* null or non-zero initial value for the object */ +} __emutls_control; + /* Emulated TLS objects are always allocated at run-time. */ static __inline void *emutls_allocate_object(__emutls_control *control) { /* Use standard C types, check with gcc's emutls.o. */ - typedef unsigned int gcc_pointer __attribute__((mode(pointer))); COMPILE_TIME_ASSERT(sizeof(uintptr_t) == sizeof(gcc_pointer)); COMPILE_TIME_ASSERT(sizeof(uintptr_t) == sizeof(void*)); @@ -93,45 +286,19 @@ static __inline void *emutls_allocate_ob return base; } -static pthread_mutex_t emutls_mutex = PTHREAD_MUTEX_INITIALIZER; - -static size_t emutls_num_object = 0; /* number of allocated TLS objects */ - -typedef struct emutls_address_array { - uintptr_t size; /* number of elements in the 'data' array */ - void* data[]; -} emutls_address_array; - -static pthread_key_t emutls_pthread_key; - -static void emutls_key_destructor(void* ptr) { - emutls_address_array* array = (emutls_address_array*)ptr; - uintptr_t i; - for (i = 0; i < array->size; ++i) { - if (array->data[i]) - emutls_memalign_free(array->data[i]); - } - free(ptr); -} - -static void emutls_init(void) { - if (pthread_key_create(&emutls_pthread_key, emutls_key_destructor) != 0) - abort(); -} /* Returns control->object.index; set index if not allocated yet. */ static __inline uintptr_t emutls_get_index(__emutls_control *control) { uintptr_t index = __atomic_load_n(&control->object.index, __ATOMIC_ACQUIRE); if (!index) { - static pthread_once_t once = PTHREAD_ONCE_INIT; - pthread_once(&once, emutls_init); - pthread_mutex_lock(&emutls_mutex); + emutls_init_once(); + emutls_lock(); index = control->object.index; if (!index) { index = ++emutls_num_object; __atomic_store_n(&control->object.index, index, __ATOMIC_RELEASE); } - pthread_mutex_unlock(&emutls_mutex); + emutls_unlock(); } return index; } @@ -142,7 +309,7 @@ static __inline void emutls_check_array_ if (array == NULL) abort(); array->size = size; - pthread_setspecific(emutls_pthread_key, (void*)array); + emutls_setspecific(array); } /* Returns the new 'data' array size, number of elements, @@ -156,22 +323,29 @@ static __inline uintptr_t emutls_new_dat return ((index + 1 + 15) & ~((uintptr_t)15)) - 1; } +/* Returns the size in bytes required for an emutls_address_array with + * N number of elements for data field. + */ +static __inline uintptr_t emutls_asize(uintptr_t N) { + return N * sizeof(void *) + sizeof(emutls_address_array); +} + /* Returns the thread local emutls_address_array. * Extends its size if necessary to hold address at index. */ static __inline emutls_address_array * emutls_get_address_array(uintptr_t index) { - emutls_address_array* array = pthread_getspecific(emutls_pthread_key); + emutls_address_array* array = emutls_getspecific(); if (array == NULL) { uintptr_t new_size = emutls_new_data_array_size(index); - array = malloc(new_size * sizeof(void *) + sizeof(emutls_address_array)); + array = (emutls_address_array*) malloc(emutls_asize(new_size)); if (array) memset(array->data, 0, new_size * sizeof(void*)); emutls_check_array_set_size(array, new_size); } else if (index > array->size) { uintptr_t orig_size = array->size; uintptr_t new_size = emutls_new_data_array_size(index); - array = realloc(array, new_size * sizeof(void *) + sizeof(emutls_address_array)); + array = (emutls_address_array*) realloc(array, emutls_asize(new_size)); if (array) memset(array->data + orig_size, 0, (new_size - orig_size) * sizeof(void*)); @@ -182,8 +356,8 @@ emutls_get_address_array(uintptr_t index void* __emutls_get_address(__emutls_control* control) { uintptr_t index = emutls_get_index(control); - emutls_address_array* array = emutls_get_address_array(index); - if (array->data[index - 1] == NULL) - array->data[index - 1] = emutls_allocate_object(control); - return array->data[index - 1]; + emutls_address_array* array = emutls_get_address_array(index--); + if (array->data[index] == NULL) + array->data[index] = emutls_allocate_object(control); + return array->data[index]; } Modified: vendor/compiler-rt/dist/lib/lsan/lsan_allocator.h ============================================================================== --- vendor/compiler-rt/dist/lib/lsan/lsan_allocator.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/lsan/lsan_allocator.h Wed Apr 26 19:24:20 2017 (r317449) @@ -59,7 +59,7 @@ typedef CompactSizeClassMap SizeClassMap typedef SizeClassAllocator32<0, SANITIZER_MMAP_RANGE_SIZE, sizeof(ChunkMetadata), SizeClassMap, kRegionSizeLog, ByteMap> PrimaryAllocator; -#elif defined(__x86_64__) +#elif defined(__x86_64__) || defined(__powerpc64__) struct AP64 { // Allocator64 parameters. Deliberately using a short name. static const uptr kSpaceBeg = 0x600000000000ULL; static const uptr kSpaceSize = 0x40000000000ULL; // 4T. Modified: vendor/compiler-rt/dist/lib/lsan/lsan_common.cc ============================================================================== --- vendor/compiler-rt/dist/lib/lsan/lsan_common.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/lsan/lsan_common.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -70,12 +70,13 @@ static const char kSuppressionLeak[] = " static const char *kSuppressionTypes[] = { kSuppressionLeak }; static const char kStdSuppressions[] = #if SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT - // The actual string allocation happens here (for more details refer to the - // SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT definition). - "leak:*_dl_map_object_deps*"; -#else - ""; + // For more details refer to the SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT + // definition. + "leak:*pthread_exit*\n" #endif // SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT + // TLS leak in some glibc versions, described in + // https://sourceware.org/bugzilla/show_bug.cgi?id=12650. + "leak:*tls_get_addr*\n"; void InitializeSuppressions() { CHECK_EQ(nullptr, suppression_ctx); Modified: vendor/compiler-rt/dist/lib/lsan/lsan_common.h ============================================================================== --- vendor/compiler-rt/dist/lib/lsan/lsan_common.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/lsan/lsan_common.h Wed Apr 26 19:24:20 2017 (r317449) @@ -32,7 +32,8 @@ // new architecture inside sanitizer library. #if (SANITIZER_LINUX && !SANITIZER_ANDROID || SANITIZER_MAC) && \ (SANITIZER_WORDSIZE == 64) && \ - (defined(__x86_64__) || defined(__mips64) || defined(__aarch64__)) + (defined(__x86_64__) || defined(__mips64) || defined(__aarch64__) || \ + defined(__powerpc64__)) #define CAN_SANITIZE_LEAKS 1 #elif defined(__i386__) && \ (SANITIZER_LINUX && !SANITIZER_ANDROID || SANITIZER_MAC) Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_local_cache.h ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_local_cache.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_local_cache.h Wed Apr 26 19:24:20 2017 (r317449) @@ -180,6 +180,7 @@ struct SizeClassAllocator32LocalCache { uptr count; uptr max_count; uptr class_size; + uptr class_id_for_transfer_batch; void *batch[2 * TransferBatch::kMaxNumCached]; }; PerClass per_class_[kNumClasses]; @@ -188,32 +189,31 @@ struct SizeClassAllocator32LocalCache { void InitCache() { if (per_class_[1].max_count) return; + // TransferBatch class is declared in SizeClassAllocator. + uptr class_id_for_transfer_batch = + SizeClassMap::ClassID(sizeof(TransferBatch)); for (uptr i = 0; i < kNumClasses; i++) { PerClass *c = &per_class_[i]; - c->max_count = 2 * TransferBatch::MaxCached(i); + uptr max_cached = TransferBatch::MaxCached(i); + c->max_count = 2 * max_cached; c->class_size = Allocator::ClassIdToSize(i); + // We transfer chunks between central and thread-local free lists in + // batches. For small size classes we allocate batches separately. For + // large size classes we may use one of the chunks to store the batch. + // sizeof(TransferBatch) must be a power of 2 for more efficient + // allocation. + c->class_id_for_transfer_batch = (c->class_size < + TransferBatch::AllocationSizeRequiredForNElements(max_cached)) ? + class_id_for_transfer_batch : 0; } } - // TransferBatch class is declared in SizeClassAllocator. - // We transfer chunks between central and thread-local free lists in batches. - // For small size classes we allocate batches separately. - // For large size classes we may use one of the chunks to store the batch. - // sizeof(TransferBatch) must be a power of 2 for more efficient allocation. - static uptr SizeClassForTransferBatch(uptr class_id) { - if (Allocator::ClassIdToSize(class_id) < - TransferBatch::AllocationSizeRequiredForNElements( - TransferBatch::MaxCached(class_id))) - return SizeClassMap::ClassID(sizeof(TransferBatch)); - return 0; - } - // Returns a TransferBatch suitable for class_id. // For small size classes allocates the batch from the allocator. // For large size classes simply returns b. TransferBatch *CreateBatch(uptr class_id, SizeClassAllocator *allocator, TransferBatch *b) { - if (uptr batch_class_id = SizeClassForTransferBatch(class_id)) + if (uptr batch_class_id = per_class_[class_id].class_id_for_transfer_batch) return (TransferBatch*)Allocate(allocator, batch_class_id); return b; } @@ -223,7 +223,7 @@ struct SizeClassAllocator32LocalCache { // Does notthing for large size classes. void DestroyBatch(uptr class_id, SizeClassAllocator *allocator, TransferBatch *b) { - if (uptr batch_class_id = SizeClassForTransferBatch(class_id)) + if (uptr batch_class_id = per_class_[class_id].class_id_for_transfer_batch) Deallocate(allocator, batch_class_id, b); } Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc Wed Apr 26 19:24:20 2017 (r317449) @@ -304,7 +304,7 @@ INTERCEPTOR(SIZE_T, strnlen, const char INTERCEPTOR(char*, textdomain, const char *domainname) { void *ctx; COMMON_INTERCEPTOR_ENTER(ctx, textdomain, domainname); - COMMON_INTERCEPTOR_READ_STRING(ctx, domainname, 0); + if (domainname) COMMON_INTERCEPTOR_READ_STRING(ctx, domainname, 0); char *domain = REAL(textdomain)(domainname); if (domain) { COMMON_INTERCEPTOR_INITIALIZE_RANGE(domain, REAL(strlen)(domain) + 1); @@ -3330,7 +3330,7 @@ INTERCEPTOR(char *, strerror, int errnum // * GNU version returns message pointer, which points to either buf or some // static storage. #if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) || \ - SANITIZER_MAC + SANITIZER_MAC || SANITIZER_ANDROID // POSIX version. Spec is not clear on whether buf is NULL-terminated. // At least on OSX, buf contents are valid even when the call fails. INTERCEPTOR(int, strerror_r, int errnum, char *buf, SIZE_T buflen) { Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.h ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.h Wed Apr 26 19:24:20 2017 (r317449) @@ -83,7 +83,7 @@ namespace __sanitizer { #elif defined(__mips__) const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID ? FIRST_32_SECOND_64(104, 128) : - FIRST_32_SECOND_64(144, 216); + FIRST_32_SECOND_64(160, 216); const unsigned struct_kernel_stat64_sz = 104; #elif defined(__s390__) && !defined(__s390x__) const unsigned struct_kernel_stat_sz = 64; Modified: vendor/compiler-rt/dist/lib/scudo/scudo_allocator.cpp ============================================================================== --- vendor/compiler-rt/dist/lib/scudo/scudo_allocator.cpp Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/scudo/scudo_allocator.cpp Wed Apr 26 19:24:20 2017 (r317449) @@ -460,6 +460,38 @@ struct ScudoAllocator { return UserPtr; } + // Place a chunk in the quarantine. In the event of a zero-sized quarantine, + // we directly deallocate the chunk, otherwise the flow would lead to the + // chunk being checksummed twice, once before Put and once in Recycle, with + // no additional security value. + void quarantineOrDeallocateChunk(ScudoChunk *Chunk, UnpackedHeader *Header, + uptr Size) { + bool BypassQuarantine = (AllocatorQuarantine.GetCacheSize() == 0); + if (BypassQuarantine) { + Chunk->eraseHeader(); + void *Ptr = Chunk->getAllocBeg(Header); + if (LIKELY(!ThreadTornDown)) { + getBackendAllocator().Deallocate(&Cache, Ptr); + } else { + SpinMutexLock Lock(&FallbackMutex); + getBackendAllocator().Deallocate(&FallbackAllocatorCache, Ptr); + } + } else { + UnpackedHeader NewHeader = *Header; + NewHeader.State = ChunkQuarantine; + Chunk->compareExchangeHeader(&NewHeader, Header); + if (LIKELY(!ThreadTornDown)) { + AllocatorQuarantine.Put(&ThreadQuarantineCache, + QuarantineCallback(&Cache), Chunk, Size); + } else { + SpinMutexLock l(&FallbackMutex); + AllocatorQuarantine.Put(&FallbackQuarantineCache, + QuarantineCallback(&FallbackAllocatorCache), + Chunk, Size); + } + } + } + // Deallocates a Chunk, which means adding it to the delayed free list (or // Quarantine). void deallocate(void *UserPtr, uptr DeleteSize, AllocType Type) { @@ -499,24 +531,12 @@ struct ScudoAllocator { } } - UnpackedHeader NewHeader = OldHeader; - NewHeader.State = ChunkQuarantine; - Chunk->compareExchangeHeader(&NewHeader, &OldHeader); - // If a small memory amount was allocated with a larger alignment, we want // to take that into account. Otherwise the Quarantine would be filled with - // tiny chunks, taking a lot of VA memory. This an approximation of the + // tiny chunks, taking a lot of VA memory. This is an approximation of the // usable size, that allows us to not call GetActuallyAllocatedSize. uptr LiableSize = Size + (OldHeader.Offset << MinAlignment); - if (LIKELY(!ThreadTornDown)) { - AllocatorQuarantine.Put(&ThreadQuarantineCache, - QuarantineCallback(&Cache), Chunk, LiableSize); - } else { - SpinMutexLock l(&FallbackMutex); - AllocatorQuarantine.Put(&FallbackQuarantineCache, - QuarantineCallback(&FallbackAllocatorCache), - Chunk, LiableSize); - } + quarantineOrDeallocateChunk(Chunk, &OldHeader, LiableSize); } // Reallocates a chunk. We can save on a new allocation if the new requested @@ -541,11 +561,11 @@ struct ScudoAllocator { OldPtr); } uptr UsableSize = Chunk->getUsableSize(&OldHeader); - UnpackedHeader NewHeader = OldHeader; // The new size still fits in the current chunk, and the size difference // is reasonable. if (NewSize <= UsableSize && (UsableSize - NewSize) < (SizeClassMap::kMaxSize / 2)) { + UnpackedHeader NewHeader = OldHeader; NewHeader.SizeOrUnusedBytes = OldHeader.FromPrimary ? NewSize : UsableSize - NewSize; Chunk->compareExchangeHeader(&NewHeader, &OldHeader); @@ -558,17 +578,7 @@ struct ScudoAllocator { uptr OldSize = OldHeader.FromPrimary ? OldHeader.SizeOrUnusedBytes : UsableSize - OldHeader.SizeOrUnusedBytes; memcpy(NewPtr, OldPtr, Min(NewSize, OldSize)); - NewHeader.State = ChunkQuarantine; - Chunk->compareExchangeHeader(&NewHeader, &OldHeader); - if (LIKELY(!ThreadTornDown)) { - AllocatorQuarantine.Put(&ThreadQuarantineCache, - QuarantineCallback(&Cache), Chunk, UsableSize); - } else { - SpinMutexLock l(&FallbackMutex); - AllocatorQuarantine.Put(&FallbackQuarantineCache, - QuarantineCallback(&FallbackAllocatorCache), - Chunk, UsableSize); - } + quarantineOrDeallocateChunk(Chunk, &OldHeader, UsableSize); } return NewPtr; } Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_external.cc ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_external.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_external.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// #include "tsan_rtl.h" +#include "tsan_interceptors.h" namespace __tsan { @@ -29,6 +30,20 @@ const char *GetObjectTypeFromTag(uptr ta return registered_tags[tag]; } +typedef void(*AccessFunc)(ThreadState *, uptr, uptr, int); +void ExternalAccess(void *addr, void *caller_pc, void *tag, AccessFunc access) { + CHECK_LT(tag, atomic_load(&used_tags, memory_order_relaxed)); + ThreadState *thr = cur_thread(); + thr->external_tag = (uptr)tag; + if (caller_pc) FuncEntry(thr, (uptr)caller_pc); + bool in_ignored_lib; + if (!caller_pc || !libignore()->IsIgnored((uptr)caller_pc, &in_ignored_lib)) { + access(thr, CALLERPC, (uptr)addr, kSizeLog1); + } + if (caller_pc) FuncExit(thr); + thr->external_tag = 0; +} + extern "C" { SANITIZER_INTERFACE_ATTRIBUTE void *__tsan_external_register_tag(const char *object_type) { @@ -54,24 +69,12 @@ void __tsan_external_assign_tag(void *ad SANITIZER_INTERFACE_ATTRIBUTE void __tsan_external_read(void *addr, void *caller_pc, void *tag) { - CHECK_LT(tag, atomic_load(&used_tags, memory_order_relaxed)); - ThreadState *thr = cur_thread(); - thr->external_tag = (uptr)tag; - FuncEntry(thr, (uptr)caller_pc); - MemoryRead(thr, CALLERPC, (uptr)addr, kSizeLog8); - FuncExit(thr); - thr->external_tag = 0; + ExternalAccess(addr, caller_pc, tag, MemoryRead); } SANITIZER_INTERFACE_ATTRIBUTE void __tsan_external_write(void *addr, void *caller_pc, void *tag) { - CHECK_LT(tag, atomic_load(&used_tags, memory_order_relaxed)); - ThreadState *thr = cur_thread(); - thr->external_tag = (uptr)tag; - FuncEntry(thr, (uptr)caller_pc); - MemoryWrite(thr, CALLERPC, (uptr)addr, kSizeLog8); - FuncExit(thr); - thr->external_tag = 0; + ExternalAccess(addr, caller_pc, tag, MemoryWrite); } } // extern "C" Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -210,7 +210,7 @@ struct ThreadSignalContext { // The object is 64-byte aligned, because we want hot data to be located in // a single cache line if possible (it's accessed in every interceptor). static ALIGNED(64) char libignore_placeholder[sizeof(LibIgnore)]; -static LibIgnore *libignore() { +LibIgnore *libignore() { return reinterpret_cast(&libignore_placeholder[0]); } @@ -269,6 +269,7 @@ ScopedInterceptor::~ScopedInterceptor() void ScopedInterceptor::EnableIgnores() { if (ignoring_) { ThreadIgnoreBegin(thr_, pc_, false); + if (flags()->ignore_noninstrumented_modules) thr_->suppress_reports++; if (in_ignored_lib_) { DCHECK(!thr_->in_ignored_lib); thr_->in_ignored_lib = true; @@ -279,6 +280,7 @@ void ScopedInterceptor::EnableIgnores() void ScopedInterceptor::DisableIgnores() { if (ignoring_) { ThreadIgnoreEnd(thr_, pc_); + if (flags()->ignore_noninstrumented_modules) thr_->suppress_reports--; if (in_ignored_lib_) { DCHECK(thr_->in_ignored_lib); thr_->in_ignored_lib = false; Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.h ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.h Wed Apr 26 19:24:20 2017 (r317449) @@ -19,6 +19,8 @@ class ScopedInterceptor { bool ignoring_; }; +LibIgnore *libignore(); + } // namespace __tsan #define SCOPED_INTERCEPTOR_RAW(func, ...) \ Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -169,7 +169,7 @@ static void PrintMop(const ReportMop *mo MopDesc(first, mop->write, mop->atomic), mop->size, (void *)mop->addr, thread_name(thrbuf, mop->tid)); } else { - Printf(" %s access of object %s at %p by %s", + Printf(" %s access of %s at %p by %s", ExternalMopDesc(first, mop->write), object_type, (void *)mop->addr, thread_name(thrbuf, mop->tid)); } @@ -202,7 +202,7 @@ static void PrintLocation(const ReportLo loc->heap_chunk_size, loc->heap_chunk_start, thread_name(thrbuf, loc->tid)); } else { - Printf(" Location is %s object of size %zu at %p allocated by %s:\n", + Printf(" Location is %s of size %zu at %p allocated by %s:\n", object_type, loc->heap_chunk_size, loc->heap_chunk_start, thread_name(thrbuf, loc->tid)); } Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.h ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.h Wed Apr 26 19:24:20 2017 (r317449) @@ -381,6 +381,7 @@ struct ThreadState { // for better performance. int ignore_reads_and_writes; int ignore_sync; + int suppress_reports; // Go does not support ignores. #if !SANITIZER_GO IgnoreSet mop_ignore_set; Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cc ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -500,7 +500,7 @@ static void AddRacyStacks(ThreadState *t } bool OutputReport(ThreadState *thr, const ScopedReport &srep) { - if (!flags()->report_bugs) + if (!flags()->report_bugs || thr->suppress_reports) return false; atomic_store_relaxed(&ctx->last_symbolize_time_ns, NanoTime()); const ReportDesc *rep = srep.GetReport(); Modified: vendor/compiler-rt/dist/test/CMakeLists.txt ============================================================================== --- vendor/compiler-rt/dist/test/CMakeLists.txt Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/CMakeLists.txt Wed Apr 26 19:24:20 2017 (r317449) @@ -41,47 +41,49 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS) if(COMPILER_RT_BUILD_BUILTINS) add_subdirectory(builtins) endif() - if(COMPILER_RT_HAS_ASAN) - add_subdirectory(asan) + if(COMPILER_RT_BUILD_SANITIZERS) + if(COMPILER_RT_HAS_ASAN) + add_subdirectory(asan) + endif() + if(COMPILER_RT_HAS_DFSAN) + add_subdirectory(dfsan) + endif() + if (COMPILER_RT_HAS_INTERCEPTION) + add_subdirectory(interception) + endif() + if(COMPILER_RT_HAS_LSAN) + add_subdirectory(lsan) + endif() + if(COMPILER_RT_HAS_MSAN) + add_subdirectory(msan) + endif() + if(COMPILER_RT_HAS_PROFILE) + add_subdirectory(profile) + endif() + if(COMPILER_RT_HAS_SANITIZER_COMMON) + add_subdirectory(sanitizer_common) + endif() + if(COMPILER_RT_HAS_TSAN) + add_subdirectory(tsan) + endif() + if(COMPILER_RT_HAS_UBSAN) + add_subdirectory(ubsan) + endif() + # CFI tests require diagnostic mode, which is implemented in UBSan. + if(COMPILER_RT_HAS_UBSAN) + add_subdirectory(cfi) + endif() + if(COMPILER_RT_HAS_SAFESTACK) + add_subdirectory(safestack) + endif() + if(COMPILER_RT_HAS_ESAN) + add_subdirectory(esan) + endif() + if(COMPILER_RT_HAS_SCUDO) + add_subdirectory(scudo) + endif() endif() - if(COMPILER_RT_HAS_DFSAN) - add_subdirectory(dfsan) - endif() - if (COMPILER_RT_HAS_INTERCEPTION) - add_subdirectory(interception) - endif() - if(COMPILER_RT_HAS_LSAN) - add_subdirectory(lsan) - endif() - if(COMPILER_RT_HAS_MSAN) - add_subdirectory(msan) - endif() - if(COMPILER_RT_HAS_PROFILE) - add_subdirectory(profile) - endif() - if(COMPILER_RT_HAS_SANITIZER_COMMON) - add_subdirectory(sanitizer_common) - endif() - if(COMPILER_RT_HAS_TSAN) - add_subdirectory(tsan) - endif() - if(COMPILER_RT_HAS_UBSAN) - add_subdirectory(ubsan) - endif() - # CFI tests require diagnostic mode, which is implemented in UBSan. - if(COMPILER_RT_HAS_UBSAN) - add_subdirectory(cfi) - endif() - if(COMPILER_RT_HAS_SAFESTACK) - add_subdirectory(safestack) - endif() - if(COMPILER_RT_HAS_ESAN) - add_subdirectory(esan) - endif() - if(COMPILER_RT_HAS_SCUDO) - add_subdirectory(scudo) - endif() - if(COMPILER_RT_HAS_XRAY) + if(COMPILER_RT_BUILD_XRAY AND COMPILER_RT_HAS_XRAY) add_subdirectory(xray) endif() endif() Modified: vendor/compiler-rt/dist/test/asan/TestCases/Linux/read_binary_name_regtest.c ============================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Linux/read_binary_name_regtest.c Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/TestCases/Linux/read_binary_name_regtest.c Wed Apr 26 19:24:20 2017 (r317449) @@ -3,6 +3,7 @@ // This test uses seccomp-BPF to restrict the readlink() system call and makes // sure ASan is still able to // RUN: not ls /usr/include/linux/seccomp.h || ( %clang_asan %s -o %t && not %run %t 2>&1 | FileCheck %s ) +// REQUIRES: shell // UNSUPPORTED: android #include Added: vendor/compiler-rt/dist/test/asan/TestCases/Linux/textdomain.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/test/asan/TestCases/Linux/textdomain.c Wed Apr 26 19:24:20 2017 (r317449) @@ -0,0 +1,10 @@ +// RUN: %clang_asan -O0 -g %s -o %t +// RUN: %env_asan_opts=strict_string_checks=1 %run %t + +#include +#include + +int main() { + textdomain(NULL); + return 0; +} Modified: vendor/compiler-rt/dist/test/asan/TestCases/Posix/strchr.c ============================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Posix/strchr.c Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/TestCases/Posix/strchr.c Wed Apr 26 19:24:20 2017 (r317449) @@ -27,9 +27,7 @@ int main(int argc, char **argv) { if (mprotect(p + 1, 1, PROT_NONE)) return 1; char *r = strchr(s, 'x'); - // CHECK: AddressSanitizer: SEGV on unknown address - // CHECK: The signal is caused by a READ memory access - // CHECK: strchr.c:[[@LINE-3]] + // CHECK: AddressSanitizer: {{SEGV|BUS}} on unknown address assert(r == p); return 0; Modified: vendor/compiler-rt/dist/test/asan/TestCases/Windows/dll_global_dead_strip.c ============================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Windows/dll_global_dead_strip.c Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/TestCases/Windows/dll_global_dead_strip.c Wed Apr 26 19:24:20 2017 (r317449) @@ -1,8 +1,8 @@ // RUN: %clang_cl_asan -O0 %p/dll_host.cc -Fe%t // -// RUN: %clang_cl_asan -LD -O0 %s -Fe%t.dll +// RUN: %clang_cl_asan /Gw -LD -O0 %s -Fe%t.dll // RUN: %env_asan_opts=report_globals=2 %run %t %t.dll 2>&1 | FileCheck %s --check-prefix=NOSTRIP -// RUN: %clang_cl_asan -LD -O2 %s -Fe%t.dll -link -opt:ref +// RUN: %clang_cl_asan /Gw -LD -O2 %s -Fe%t.dll -link -opt:ref // RUN: %env_asan_opts=report_globals=2 %run %t %t.dll 2>&1 | FileCheck %s --check-prefix=STRIP #include Modified: vendor/compiler-rt/dist/test/asan/TestCases/Windows/fuse-lld.cc ============================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Windows/fuse-lld.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/TestCases/Windows/fuse-lld.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -1,6 +1,6 @@ // If we have LLD, see that things more or less work. // -// REQUIRES: lld +// REQUIRES: lld-available // // FIXME: Use -fuse-ld=lld after the old COFF linker is removed. // FIXME: Test will fail until we add flags for requesting dwarf or cv. Modified: vendor/compiler-rt/dist/test/asan/TestCases/Windows/global_dead_strip.c ============================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Windows/global_dead_strip.c Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/TestCases/Windows/global_dead_strip.c Wed Apr 26 19:24:20 2017 (r317449) @@ -1,6 +1,6 @@ -// RUN: %clang_cl_asan /O0 %s /Fe%t.exe +// RUN: %clang_cl_asan /Gw /O0 %s /Fe%t.exe // RUN: %env_asan_opts=report_globals=2 %t.exe 2>&1 | FileCheck %s --check-prefix=NOSTRIP -// RUN: %clang_cl_asan /O2 %s /Fe%t.exe -link -opt:ref +// RUN: %clang_cl_asan /Gw /O2 %s /Fe%t.exe -link -opt:ref // RUN: %env_asan_opts=report_globals=2 %t.exe 2>&1 | FileCheck %s --check-prefix=STRIP #include Modified: vendor/compiler-rt/dist/test/asan/android_commands/android_run.py ============================================================================== --- vendor/compiler-rt/dist/test/asan/android_commands/android_run.py Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/android_commands/android_run.py Wed Apr 26 19:24:20 2017 (r317449) @@ -18,15 +18,14 @@ def build_env(): return ' '.join(args) is_64bit = (subprocess.check_output(['file', sys.argv[0] + '.real']).find('64-bit') != -1) -asanwrapper = "" if is_64bit else "asanwrapper " device_env = build_env() device_args = ' '.join(sys.argv[1:]) # FIXME: escape? device_stdout = device_binary + '.stdout' device_stderr = device_binary + '.stderr' device_exitcode = device_binary + '.exitcode' -ret = adb(['shell', 'cd %s && %s %s%s %s >%s 2>%s ; echo $? >%s' % - (ANDROID_TMPDIR, device_env, asanwrapper, device_binary, device_args, +ret = adb(['shell', 'cd %s && %s %s %s >%s 2>%s ; echo $? >%s' % + (ANDROID_TMPDIR, device_env, device_binary, device_args, device_stdout, device_stderr, device_exitcode)]) if ret != 0: sys.exit(ret) Modified: vendor/compiler-rt/dist/test/cfi/CMakeLists.txt ============================================================================== --- vendor/compiler-rt/dist/test/cfi/CMakeLists.txt Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/cfi/CMakeLists.txt Wed Apr 26 19:24:20 2017 (r317449) @@ -1,14 +1,48 @@ -set(CFI_LIT_TEST_MODE Standalone) -configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in - ${CMAKE_CURRENT_BINARY_DIR}/Standalone/lit.site.cfg - ) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Wed Apr 26 19:24:28 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94D8CD51C50; Wed, 26 Apr 2017 19:24:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 484E198E; Wed, 26 Apr 2017 19:24:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QJORtt030432; Wed, 26 Apr 2017 19:24:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJORRu030431; Wed, 26 Apr 2017 19:24:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJORRu030431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317450 - vendor/compiler-rt/compiler-rt-trunk-r301441 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:28 -0000 Author: dim Date: Wed Apr 26 19:24:27 2017 New Revision: 317450 URL: https://svnweb.freebsd.org/changeset/base/317450 Log: Tag compiler-rt trunk r301441. Added: vendor/compiler-rt/compiler-rt-trunk-r301441/ - copied from r317449, vendor/compiler-rt/dist/ From owner-svn-src-vendor@freebsd.org Wed Apr 26 19:24:18 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F318D51BE6; Wed, 26 Apr 2017 19:24:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 278218D8; Wed, 26 Apr 2017 19:24:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QJOHpe030310; Wed, 26 Apr 2017 19:24:17 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJOHgM030309; Wed, 26 Apr 2017 19:24:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJOHgM030309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317448 - vendor/clang/clang-trunk-r301441 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:18 -0000 Author: dim Date: Wed Apr 26 19:24:17 2017 New Revision: 317448 URL: https://svnweb.freebsd.org/changeset/base/317448 Log: Tag clang trunk r301441. Added: vendor/clang/clang-trunk-r301441/ - copied from r317447, vendor/clang/dist/ From owner-svn-src-vendor@freebsd.org Wed Apr 26 19:24:36 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53621D51CBD; Wed, 26 Apr 2017 19:24:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EB64A4B; Wed, 26 Apr 2017 19:24:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QJOZQD030514; Wed, 26 Apr 2017 19:24:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJOVgJ030479; Wed, 26 Apr 2017 19:24:31 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJOVgJ030479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317451 - in vendor/libc++/dist: . include test/libcxx/atomics test/libcxx/language.support/support.dynamic test/libcxx/localization/locales/locale.convenience/conversions/conversions.s... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:36 -0000 Author: dim Date: Wed Apr 26 19:24:31 2017 New Revision: 317451 URL: https://svnweb.freebsd.org/changeset/base/317451 Log: Vendor import of libc++ trunk r301441: https://llvm.org/svn/llvm-project/libcxx/trunk@301441 Modified: vendor/libc++/dist/CMakeLists.txt vendor/libc++/dist/include/atomic vendor/libc++/dist/include/math.h vendor/libc++/dist/include/mutex vendor/libc++/dist/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp vendor/libc++/dist/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp vendor/libc++/dist/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp vendor/libc++/dist/test/libcxx/modules/cinttypes_exports.sh.cpp vendor/libc++/dist/test/libcxx/modules/clocale_exports.sh.cpp vendor/libc++/dist/test/libcxx/modules/cstdint_exports.sh.cpp vendor/libc++/dist/test/libcxx/modules/inttypes_h_exports.sh.cpp vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/assign.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/propagation/current_exception.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp vendor/libc++/dist/test/std/numerics/c.math/cmath.pass.cpp vendor/libc++/dist/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp vendor/libc++/dist/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp vendor/libc++/dist/utils/libcxx/test/config.py Modified: vendor/libc++/dist/CMakeLists.txt ============================================================================== --- vendor/libc++/dist/CMakeLists.txt Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/CMakeLists.txt Wed Apr 26 19:24:31 2017 (r317451) @@ -120,21 +120,19 @@ if (LIBCXX_CXX_ABI STREQUAL "default") ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include NO_DEFAULT_PATH ) - if ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND - IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") + if (LIBCXX_TARGETING_MSVC) + # FIXME: Figure out how to configure the ABI library on Windows. + set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") + elseif ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND + IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_INTREE 1) + elseif (APPLE) + set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") + set(LIBCXX_CXX_ABI_SYSTEM 1) else() - if (LIBCXX_TARGETING_MSVC) - # FIXME: Figure out how to configure the ABI library on Windows. - set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") - elseif(APPLE) - set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") - set(LIBCXX_CXX_ABI_SYSTEM 1) - else() - set(LIBCXX_CXX_ABI_LIBNAME "default") - endif() + set(LIBCXX_CXX_ABI_LIBNAME "default") endif() else() set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}") Modified: vendor/libc++/dist/include/atomic ============================================================================== --- vendor/libc++/dist/include/atomic Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/include/atomic Wed Apr 26 19:24:31 2017 (r317451) @@ -861,16 +861,29 @@ kill_dependency(_Tp __y) _NOEXCEPT return __y; } -#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE -#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE -#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE -#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE -#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE -#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE -#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE -#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE -#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE -#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) +# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE +# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE +#else +# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#endif // general atomic Modified: vendor/libc++/dist/include/math.h ============================================================================== --- vendor/libc++/dist/include/math.h Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/include/math.h Wed Apr 26 19:24:31 2017 (r317451) @@ -307,6 +307,7 @@ long double truncl(long double x); extern "C++" { #include +#include // signbit @@ -324,22 +325,50 @@ __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type signbit(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type +signbit(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x < 0; } + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type +signbit(_A1) _NOEXCEPT +{ return false; } + #elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type signbit(_A1 __lcpp_x) _NOEXCEPT { return ::signbit(static_cast::type>(__lcpp_x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type +signbit(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x < 0; } + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type +signbit(_A1) _NOEXCEPT +{ return false; } + #endif // signbit // fpclassify @@ -358,22 +387,34 @@ __libcpp_fpclassify(_A1 __lcpp_x) _NOEXC template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type +typename std::enable_if::value, int>::type fpclassify(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } + #elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type +typename std::enable_if::value, bool>::type fpclassify(_A1 __lcpp_x) _NOEXCEPT { return ::fpclassify(static_cast::type>(__lcpp_x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } + #endif // fpclassify // isfinite @@ -392,12 +433,22 @@ __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEP template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if< + std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, + bool>::type isfinite(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, + bool>::type +isfinite(_A1) _NOEXCEPT +{ return true; } + #endif // isfinite // isinf @@ -416,12 +467,22 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if< + std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, + bool>::type isinf(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, + bool>::type +isinf(_A1) _NOEXCEPT +{ return false; } + #endif // isinf // isnan @@ -440,12 +501,18 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnan(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnan(_A1) _NOEXCEPT +{ return false; } + #endif // isnan // isnormal @@ -464,12 +531,18 @@ __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEP template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnormal(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnormal(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x != 0; } + #endif // isnormal // isgreater Modified: vendor/libc++/dist/include/mutex ============================================================================== --- vendor/libc++/dist/include/mutex Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/include/mutex Wed Apr 26 19:24:31 2017 (r317451) @@ -685,7 +685,7 @@ inline _LIBCPP_INLINE_VISIBILITY void call_once(once_flag& __flag, const _Callable& __func) { - if (__flag.__state_ != ~0ul) + if (__libcpp_acquire_load(&__flag.__state_) != ~0ul) { __call_once_param __p(__func); __call_once(__flag.__state_, &__p, &__call_once_proxy); Modified: vendor/libc++/dist/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails because diagnose_if doesn't emit all of the diagnostics +// when -fdelayed-template-parsing is enabled, like it is on Windows. +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: verify-support, diagnose-if-support // UNSUPPORTED: libcpp-has-no-threads Modified: vendor/libc++/dist/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -10,6 +10,10 @@ // test libc++'s implementation of align_val_t, and the relevent new/delete // overloads in all dialects when -faligned-allocation is present. +// Libc++ defers to the underlying MSVC library to provide the new/delete +// definitions, which does not yet provide aligned allocation +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: -faligned-allocation // RUN: %build -faligned-allocation @@ -74,4 +78,4 @@ int main() { assert(typeid(std::align_val_t).name() == std::string("St11align_val_t")); } #endif -} \ No newline at end of file +} Modified: vendor/libc++/dist/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// 'do_bytes' throws a std::range_error unexpectedly +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: c++98, c++03 // Modified: vendor/libc++/dist/test/libcxx/modules/cinttypes_exports.sh.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/modules/cinttypes_exports.sh.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/modules/cinttypes_exports.sh.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that re-exports Modified: vendor/libc++/dist/test/libcxx/modules/clocale_exports.sh.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/modules/clocale_exports.sh.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/modules/clocale_exports.sh.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // UNSUPPORTED: c++98, c++03 Modified: vendor/libc++/dist/test/libcxx/modules/cstdint_exports.sh.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/modules/cstdint_exports.sh.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/modules/cstdint_exports.sh.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that re-exports Modified: vendor/libc++/dist/test/libcxx/modules/inttypes_h_exports.sh.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/modules/inttypes_h_exports.sh.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/modules/inttypes_h_exports.sh.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that intypes.h re-exports stdint.h Modified: vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -8,6 +8,9 @@ //===----------------------------------------------------------------------===// // +// This test depends on std::exception_ptr which has not yet been implemented. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03 Modified: vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -6,7 +6,9 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// + +// This test depends on std::exception_ptr which has not yet been implemented. +// XFAIL: LIBCXX-WINDOWS-FIXME // UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads Modified: vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety Modified: vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety Modified: vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety Modified: vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/assign.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/assign.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/assign.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // class nested_exception; Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // class nested_exception; Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // class nested_exception; Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // @@ -43,7 +46,7 @@ class C { public: virtual ~C() {} - C * operator&() const { assert(false); } // should not be called + C * operator&() const { assert(false); return nullptr; } // should not be called }; class D : private std::nested_exception {}; Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // Modified: vendor/libc++/dist/test/std/language.support/support.exception/propagation/current_exception.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/propagation/current_exception.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/propagation/current_exception.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // Modified: vendor/libc++/dist/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // typedef unspecified exception_ptr; Modified: vendor/libc++/dist/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // Modified: vendor/libc++/dist/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // Modified: vendor/libc++/dist/test/std/numerics/c.math/cmath.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/numerics/c.math/cmath.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/numerics/c.math/cmath.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -10,6 +10,7 @@ // #include +#include #include #include @@ -551,6 +552,13 @@ void test_signbit() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::signbit(-1.0) == true); + assert(std::signbit(0u) == false); + assert(std::signbit(std::numeric_limits::max()) == false); + assert(std::signbit(0) == false); + assert(std::signbit(1) == false); + assert(std::signbit(-1) == true); + assert(std::signbit(std::numeric_limits::max()) == false); + assert(std::signbit(std::numeric_limits::min()) == true); } void test_fpclassify() @@ -564,6 +572,11 @@ void test_fpclassify() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::fpclassify(-1.0) == FP_NORMAL); + assert(std::fpclassify(0) == FP_ZERO); + assert(std::fpclassify(1) == FP_NORMAL); + assert(std::fpclassify(-1) == FP_NORMAL); + assert(std::fpclassify(std::numeric_limits::max()) == FP_NORMAL); + assert(std::fpclassify(std::numeric_limits::min()) == FP_NORMAL); } void test_isfinite() @@ -577,6 +590,11 @@ void test_isfinite() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isfinite(-1.0) == true); + assert(std::isfinite(0) == true); + assert(std::isfinite(1) == true); + assert(std::isfinite(-1) == true); + assert(std::isfinite(std::numeric_limits::max()) == true); + assert(std::isfinite(std::numeric_limits::min()) == true); } void test_isnormal() @@ -590,6 +608,11 @@ void test_isnormal() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isnormal(-1.0) == true); + assert(std::isnormal(0) == false); + assert(std::isnormal(1) == true); + assert(std::isnormal(-1) == true); + assert(std::isnormal(std::numeric_limits::max()) == true); + assert(std::isnormal(std::numeric_limits::min()) == true); } void test_isgreater() @@ -651,6 +674,11 @@ void test_isinf() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isinf(-1.0) == false); + assert(std::isinf(0) == false); + assert(std::isinf(1) == false); + assert(std::isinf(-1) == false); + assert(std::isinf(std::numeric_limits::max()) == false); + assert(std::isinf(std::numeric_limits::min()) == false); } void test_isless() @@ -731,6 +759,11 @@ void test_isnan() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isnan(-1.0) == false); + assert(std::isnan(0) == false); + assert(std::isnan(1) == false); + assert(std::isnan(-1) == false); + assert(std::isnan(std::numeric_limits::max()) == false); + assert(std::isnan(std::numeric_limits::min()) == false); } void test_isunordered() Modified: vendor/libc++/dist/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -63,7 +63,6 @@ void test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a) { typedef typename S::traits_type T; - typedef typename S::allocator_type A; if (pos <= sv.size()) { S s2(sv, pos, n, a); Modified: vendor/libc++/dist/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -44,7 +44,7 @@ void test_emplace_type() { auto &v = a.emplace(); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -60,7 +60,7 @@ void test_emplace_type() { auto &v = a.emplace(101); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -76,7 +76,7 @@ void test_emplace_type() { auto &v = a.emplace(-1, 42, -1); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -97,7 +97,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace(); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch(a); @@ -107,7 +107,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace(-1, 42, -1); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch(a); @@ -118,7 +118,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace({-1, 42, -1}); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch>(a); @@ -129,7 +129,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace({-1, 42, -1}, x); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch, int&>(a); @@ -159,7 +159,8 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - a.emplace(101); + auto &v = a.emplace(101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -169,7 +170,8 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - a.emplace({1, 2, 3}, 101); + auto &v = a.emplace({1, 2, 3}, 101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -180,7 +182,8 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - a.emplace(101); + auto &v = a.emplace(101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -190,7 +193,8 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - a.emplace({1, 2, 3}, 101); + auto &v = a.emplace({1, 2, 3}, 101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } Modified: vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -254,7 +254,9 @@ int main() { assert(static_cast(opt) == true); assert(Y::dtor_called == false); - opt.emplace(1); + auto &v = opt.emplace(1); + static_assert( std::is_same_v, "" ); + assert(false); } catch (int i) { Modified: vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -11,7 +11,7 @@ // // template -// void optional::emplace(initializer_list il, Args&&... args); +// T& optional::emplace(initializer_list il, Args&&... args); #include #include @@ -76,21 +76,27 @@ int main() X x; optional opt(x); assert(X::dtor_called == false); - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); assert(X::dtor_called == true); assert(*opt == X({1, 2})); + assert(&v == &*opt); } { optional> opt; - opt.emplace({1, 2, 3}, std::allocator()); + auto &v = opt.emplace({1, 2, 3}, std::allocator()); + static_assert( std::is_same_v&, decltype(v)>, "" ); assert(static_cast(opt) == true); assert(*opt == std::vector({1, 2, 3})); + assert(&v == &*opt); } { optional opt; - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); assert(static_cast(opt) == true); assert(*opt == Y({1, 2})); + assert(&v == &*opt); } #ifndef TEST_HAS_NO_EXCEPTIONS { @@ -100,7 +106,9 @@ int main() { assert(static_cast(opt) == true); assert(Z::dtor_called == false); - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); + assert(false); } catch (int i) { Modified: vendor/libc++/dist/utils/libcxx/test/config.py ============================================================================== --- vendor/libc++/dist/utils/libcxx/test/config.py Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/utils/libcxx/test/config.py Wed Apr 26 19:24:31 2017 (r317451) @@ -311,10 +311,10 @@ class Configuration(object): # NOTE: We do not test for the -verify flag directly because # -verify will always exit with non-zero on an empty file. self.use_clang_verify = self.cxx.isVerifySupported() - if self.use_clang_verify: - self.config.available_features.add('verify-support') self.lit_config.note( "inferred use_clang_verify as: %r" % self.use_clang_verify) + if self.use_clang_verify: + self.config.available_features.add('verify-support') def configure_use_thread_safety(self): '''If set, run clang with -verify on failing tests.''' @@ -418,7 +418,7 @@ class Configuration(object): # initial Windows failures until they can be properly diagnosed # and fixed. This allows easier detection of new test failures # and regressions. Note: New failures should not be suppressed - # using this feature. + # using this feature. (Also see llvm.org/PR32730) self.config.available_features.add('LIBCXX-WINDOWS-FIXME') # Attempt to detect the glibc version by querying for __GLIBC__ From owner-svn-src-vendor@freebsd.org Wed Apr 26 19:24:41 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EC0AD51CE8; Wed, 26 Apr 2017 19:24:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC108AB0; Wed, 26 Apr 2017 19:24:40 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QJOdGQ030561; Wed, 26 Apr 2017 19:24:39 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJOdlD030560; Wed, 26 Apr 2017 19:24:39 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJOdlD030560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317452 - vendor/libc++/libc++-trunk-r301441 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:41 -0000 Author: dim Date: Wed Apr 26 19:24:39 2017 New Revision: 317452 URL: https://svnweb.freebsd.org/changeset/base/317452 Log: Tag libc++ trunk r301441. Added: vendor/libc++/libc++-trunk-r301441/ - copied from r317451, vendor/libc++/dist/ From owner-svn-src-vendor@freebsd.org Wed Apr 26 19:24:47 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AAF6D51D4F; Wed, 26 Apr 2017 19:24:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16136B59; Wed, 26 Apr 2017 19:24:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QJOkcF030645; Wed, 26 Apr 2017 19:24:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJOgrT030609; Wed, 26 Apr 2017 19:24:42 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJOgrT030609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317453 - in vendor/lld/dist: COFF ELF test/COFF test/COFF/Inputs test/ELF test/ELF/Inputs test/ELF/linkerscript test/ELF/lto X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:47 -0000 Author: dim Date: Wed Apr 26 19:24:42 2017 New Revision: 317453 URL: https://svnweb.freebsd.org/changeset/base/317453 Log: Vendor import of lld trunk r301441: https://llvm.org/svn/llvm-project/lld/trunk@301441 Added: vendor/lld/dist/test/COFF/Inputs/constant-export.ll vendor/lld/dist/test/COFF/Inputs/msvclto-order-a.ll vendor/lld/dist/test/COFF/Inputs/msvclto-order-b.ll vendor/lld/dist/test/COFF/constant-export.test vendor/lld/dist/test/COFF/constant-export.yaml vendor/lld/dist/test/COFF/msvclto-order.ll vendor/lld/dist/test/ELF/Inputs/progname-ver.s (contents, props changed) vendor/lld/dist/test/ELF/defsym.s (contents, props changed) vendor/lld/dist/test/ELF/driver-access.test vendor/lld/dist/test/ELF/icf-i386.s (contents, props changed) Deleted: vendor/lld/dist/test/ELF/Inputs/progname-ver.so Modified: vendor/lld/dist/COFF/Chunks.cpp vendor/lld/dist/COFF/Config.h vendor/lld/dist/COFF/Driver.cpp vendor/lld/dist/COFF/Driver.h vendor/lld/dist/COFF/DriverUtils.cpp vendor/lld/dist/COFF/InputFiles.h vendor/lld/dist/COFF/Librarian.cpp vendor/lld/dist/COFF/ModuleDef.cpp vendor/lld/dist/COFF/SymbolTable.h vendor/lld/dist/ELF/Driver.cpp vendor/lld/dist/ELF/Filesystem.cpp vendor/lld/dist/ELF/Filesystem.h vendor/lld/dist/ELF/InputFiles.cpp vendor/lld/dist/ELF/InputFiles.h vendor/lld/dist/ELF/Options.td vendor/lld/dist/ELF/OutputSections.cpp vendor/lld/dist/ELF/SymbolTable.cpp vendor/lld/dist/ELF/SymbolTable.h vendor/lld/dist/ELF/Symbols.cpp vendor/lld/dist/ELF/SyntheticSections.cpp vendor/lld/dist/ELF/Target.cpp vendor/lld/dist/ELF/Writer.cpp vendor/lld/dist/test/COFF/linkenv.test vendor/lld/dist/test/ELF/incompatible-section-flags.s vendor/lld/dist/test/ELF/linkerscript/sections.s vendor/lld/dist/test/ELF/lto/asmundef.ll vendor/lld/dist/test/ELF/progname.s vendor/lld/dist/test/ELF/tls-dynamic-i686.s Modified: vendor/lld/dist/COFF/Chunks.cpp ============================================================================== --- vendor/lld/dist/COFF/Chunks.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/Chunks.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -319,8 +319,48 @@ void SEHTableChunk::writeTo(uint8_t *Buf std::sort(Begin, Begin + Cnt); } -// Windows-specific. -// This class represents a block in .reloc section. +// Windows-specific. This class represents a block in .reloc section. +// The format is described here. +// +// On Windows, each DLL is linked against a fixed base address and +// usually loaded to that address. However, if there's already another +// DLL that overlaps, the loader has to relocate it. To do that, DLLs +// contain .reloc sections which contain offsets that need to be fixed +// up at runtime. If the loader find that a DLL cannot be loaded to its +// desired base address, it loads it to somewhere else, and add - to each offset that is +// specified by .reloc section. +// +// In ELF terms, .reloc sections contain arrays of relocation offsets. +// All these offsets in the section are implicitly R_*_RELATIVE, and +// addends are read from section contents (so it is REL as opposed to +// RELA). +// +// This already reduce the size of relocations to 1/3 compared to ELF +// .dynrel, but Windows does more to reduce it (probably because it was +// invented for PCs in the late '80s or early '90s.) Offsets in .reloc +// are grouped by page where page size is 16 bits, and offsets sharing +// the same page address are stored consecutively to represent them with +// less space. This is a very similar to the page table which is grouped +// by (multiple stages of) pages. +// +// For example, let's say we have 0x00030, 0x00500, 0x01000, 0x01100, +// 0x20004, and 0x20008 in a .reloc section. In the section, they are +// represented like this: +// +// 0x00000 -- page address (4 bytes) +// 16 -- size of this block (4 bytes) +// 0x0030 -- entries (2 bytes each) +// 0x0500 +// 0x1000 +// 0x1100 +// 0x20000 -- page address (4 bytes) +// 12 -- size of this block (4 bytes) +// 0x0004 -- entries (2 bytes each) +// 0x0008 +// +// Usually we have a lot of relocatinos for each page, so the number of +// bytes for one .reloc entry is close to 2 bytes. BaserelChunk::BaserelChunk(uint32_t Page, Baserel *Begin, Baserel *End) { // Block header consists of 4 byte page RVA and 4 byte block size. // Each entry is 2 byte. Last entry may be padding. Modified: vendor/lld/dist/COFF/Config.h ============================================================================== --- vendor/lld/dist/COFF/Config.h Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/Config.h Wed Apr 26 19:24:42 2017 (r317453) @@ -43,6 +43,7 @@ struct Export { bool Noname = false; bool Data = false; bool Private = false; + bool Constant = false; // If an export is a form of /export:foo=dllname.bar, that means // that foo should be exported as an alias to bar in the DLL. Modified: vendor/lld/dist/COFF/Driver.cpp ============================================================================== --- vendor/lld/dist/COFF/Driver.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/Driver.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -512,6 +512,23 @@ void LinkerDriver::invokeMSVC(opt::Input std::string Rsp = "/nologo\n"; std::vector Temps; + // Write out archive members that we used in symbol resolution and pass these + // to MSVC before any archives, so that MSVC uses the same objects to satisfy + // references. + for (const auto *O : Symtab.ObjectFiles) { + if (O->ParentName.empty()) + continue; + SmallString<128> S; + int Fd; + if (auto EC = sys::fs::createTemporaryFile( + "lld-" + sys::path::filename(O->ParentName), ".obj", Fd, S)) + fatal(EC, "cannot create a temporary file"); + raw_fd_ostream OS(Fd, /*shouldClose*/ true); + OS << O->MB.getBuffer(); + Temps.push_back(S.str()); + Rsp += quote(S) + "\n"; + } + for (auto *Arg : Args) { switch (Arg->getOption().getID()) { case OPT_linkrepro: Modified: vendor/lld/dist/COFF/Driver.h ============================================================================== --- vendor/lld/dist/COFF/Driver.h Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/Driver.h Wed Apr 26 19:24:42 2017 (r317453) @@ -48,7 +48,7 @@ public: llvm::opt::InputArgList parse(llvm::ArrayRef Args); // Concatenate LINK environment varirable and given arguments and parse them. - llvm::opt::InputArgList parseLINK(llvm::ArrayRef Args); + llvm::opt::InputArgList parseLINK(std::vector Args); // Tokenizes a given string and then parses as command line options. llvm::opt::InputArgList parse(StringRef S) { return parse(tokenize(S)); } Modified: vendor/lld/dist/COFF/DriverUtils.cpp ============================================================================== --- vendor/lld/dist/COFF/DriverUtils.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/DriverUtils.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -479,6 +479,10 @@ Export parseExport(StringRef Arg) { E.Data = true; continue; } + if (Tok.equals_lower("constant")) { + E.Constant = true; + continue; + } if (Tok.equals_lower("private")) { E.Private = true; continue; @@ -695,17 +699,20 @@ opt::InputArgList ArgParser::parse(Array return Args; } -// link.exe has an interesting feature. If LINK environment exists, -// its contents are handled as a command line string. So you can pass -// extra arguments using the environment variable. -opt::InputArgList ArgParser::parseLINK(ArrayRef Args) { +// link.exe has an interesting feature. If LINK or _LINK_ environment +// variables exist, their contents are handled as command line strings. +// So you can pass extra arguments using them. +opt::InputArgList ArgParser::parseLINK(std::vector Args) { // Concatenate LINK env and command line arguments, and then parse them. - Optional Env = Process::GetEnv("LINK"); - if (!Env) - return parse(Args); - std::vector V = tokenize(*Env); - V.insert(V.end(), Args.begin(), Args.end()); - return parse(V); + if (Optional S = Process::GetEnv("LINK")) { + std::vector V = tokenize(*S); + Args.insert(Args.begin(), V.begin(), V.end()); + } + if (Optional S = Process::GetEnv("_LINK_")) { + std::vector V = tokenize(*S); + Args.insert(Args.begin(), V.begin(), V.end()); + } + return parse(Args); } std::vector ArgParser::tokenize(StringRef S) { Modified: vendor/lld/dist/COFF/InputFiles.h ============================================================================== --- vendor/lld/dist/COFF/InputFiles.h Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/InputFiles.h Wed Apr 26 19:24:42 2017 (r317453) @@ -58,6 +58,8 @@ public: // Returns the CPU type this file was compiled to. virtual MachineTypes getMachineType() { return IMAGE_FILE_MACHINE_UNKNOWN; } + MemoryBufferRef MB; + // An archive file name if this file is created from an archive. StringRef ParentName; @@ -67,7 +69,6 @@ public: protected: InputFile(Kind K, MemoryBufferRef M) : MB(M), FileKind(K) {} - MemoryBufferRef MB; std::string Directives; private: Modified: vendor/lld/dist/COFF/Librarian.cpp ============================================================================== --- vendor/lld/dist/COFF/Librarian.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/Librarian.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -162,7 +162,7 @@ public: // Create a short import file which is described in PE/COFF spec 7. Import // Library Format. NewArchiveMember createShortImport(StringRef Sym, uint16_t Ordinal, - ImportNameType NameType, bool isData); + ImportType Type, ImportNameType NameType); }; } @@ -440,8 +440,8 @@ NewArchiveMember ObjectFactory::createNu NewArchiveMember ObjectFactory::createShortImport(StringRef Sym, uint16_t Ordinal, - ImportNameType NameType, - bool isData) { + ImportType ImportType, + ImportNameType NameType) { size_t ImpSize = DLLName.size() + Sym.size() + 2; // +2 for NULs size_t Size = sizeof(coff_import_header) + ImpSize; char *Buf = Alloc.Allocate(Size); @@ -456,8 +456,7 @@ NewArchiveMember ObjectFactory::createSh Imp->SizeOfData = ImpSize; if (Ordinal > 0) Imp->OrdinalHint = Ordinal; - Imp->TypeInfo = (isData ? IMPORT_DATA : IMPORT_CODE); - Imp->TypeInfo |= NameType << 2; + Imp->TypeInfo = (NameType << 2) | ImportType; // Write symbol name and DLL name. memcpy(P, Sym.data(), Sym.size()); @@ -490,11 +489,18 @@ void lld::coff::writeImportLibrary() { if (E.Private) continue; - ImportNameType Type = getNameType(E.SymbolName, E.Name); + ImportType ImportType = IMPORT_CODE; + if (E.Data) + ImportType = IMPORT_DATA; + if (E.Constant) + ImportType = IMPORT_CONST; + + ImportNameType NameType = getNameType(E.SymbolName, E.Name); std::string Name = E.ExtName.empty() ? std::string(E.SymbolName) : replace(E.SymbolName, E.Name, E.ExtName); - Members.push_back(OF.createShortImport(Name, E.Ordinal, Type, E.Data)); + Members.push_back(OF.createShortImport(Name, E.Ordinal, ImportType, + NameType)); } std::pair Result = Modified: vendor/lld/dist/COFF/ModuleDef.cpp ============================================================================== --- vendor/lld/dist/COFF/ModuleDef.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/ModuleDef.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -38,6 +38,7 @@ enum Kind { Comma, Equal, KwBase, + KwConstant, KwData, KwExports, KwHeapsize, @@ -92,6 +93,7 @@ public: StringRef Word = Buf.substr(0, End); Kind K = llvm::StringSwitch(Word) .Case("BASE", KwBase) + .Case("CONSTANT", KwConstant) .Case("DATA", KwData) .Case("EXPORTS", KwExports) .Case("HEAPSIZE", KwHeapsize) @@ -227,6 +229,11 @@ private: E.Data = true; continue; } + if (Tok.K == KwConstant) { + warn("CONSTANT keyword is obsolete; use DATA"); + E.Constant = true; + continue; + } if (Tok.K == KwPrivate) { E.Private = true; continue; Modified: vendor/lld/dist/COFF/SymbolTable.h ============================================================================== --- vendor/lld/dist/COFF/SymbolTable.h Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/SymbolTable.h Wed Apr 26 19:24:42 2017 (r317453) @@ -108,14 +108,9 @@ public: std::vector LocalImportChunks; private: - void readArchive(); - void readObjects(); - std::pair insert(StringRef Name); StringRef findByPrefix(StringRef Prefix); - void addCombinedLTOObject(ObjectFile *Obj); - llvm::DenseMap Symtab; std::vector BitcodeFiles; Modified: vendor/lld/dist/ELF/Driver.cpp ============================================================================== --- vendor/lld/dist/ELF/Driver.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/ELF/Driver.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -184,8 +184,6 @@ void LinkerDriver::addFile(StringRef Pat error("attempted static link of dynamic object " + Path); return; } - Files.push_back(createSharedFile(MBRef)); - // DSOs usually have DT_SONAME tags in their ELF headers, and the // sonames are used to identify DSOs. But if they are missing, // they are identified by filenames. We don't know whether the new @@ -196,8 +194,8 @@ void LinkerDriver::addFile(StringRef Pat // If a file was specified by -lfoo, the directory part is not // significant, as a user did not specify it. This behavior is // compatible with GNU. - Files.back()->DefaultSoName = - WithLOption ? sys::path::filename(Path) : Path; + Files.push_back(createSharedFile( + MBRef, WithLOption ? sys::path::filename(Path) : Path)); return; default: if (InLib) @@ -708,10 +706,6 @@ void LinkerDriver::readConfigs(opt::Inpu if (!Config->Shared && !Config->AuxiliaryList.empty()) error("-f may not be used without -shared"); - for (auto *Arg : Args.filtered(OPT_dynamic_list)) - if (Optional Buffer = readFile(Arg->getValue())) - readDynamicList(*Buffer); - if (auto *Arg = Args.getLastArg(OPT_symbol_ordering_file)) if (Optional Buffer = readFile(Arg->getValue())) Config->SymbolOrderingFile = getLines(*Buffer); @@ -726,21 +720,31 @@ void LinkerDriver::readConfigs(opt::Inpu {S, /*IsExternCpp*/ false, /*HasWildcard*/ false}); } - for (auto *Arg : Args.filtered(OPT_export_dynamic_symbol)) - Config->VersionScriptGlobals.push_back( - {Arg->getValue(), /*IsExternCpp*/ false, /*HasWildcard*/ false}); - - // Dynamic lists are a simplified linker script that doesn't need the - // "global:" and implicitly ends with a "local:*". Set the variables needed to - // simulate that. - if (Args.hasArg(OPT_dynamic_list) || Args.hasArg(OPT_export_dynamic_symbol)) { - Config->ExportDynamic = true; - if (!Config->Shared) - Config->DefaultSymbolVersion = VER_NDX_LOCAL; - } + bool HasExportDynamic = + getArg(Args, OPT_export_dynamic, OPT_no_export_dynamic, false); - if (getArg(Args, OPT_export_dynamic, OPT_no_export_dynamic, false)) - Config->DefaultSymbolVersion = VER_NDX_GLOBAL; + // Parses -dynamic-list and -export-dynamic-symbol. They make some + // symbols private. Note that -export-dynamic takes precedence over them + // as it says all symbols should be exported. + if (!HasExportDynamic) { + for (auto *Arg : Args.filtered(OPT_dynamic_list)) + if (Optional Buffer = readFile(Arg->getValue())) + readDynamicList(*Buffer); + + for (auto *Arg : Args.filtered(OPT_export_dynamic_symbol)) + Config->VersionScriptGlobals.push_back( + {Arg->getValue(), /*IsExternCpp*/ false, /*HasWildcard*/ false}); + + // Dynamic lists are a simplified linker script that doesn't need the + // "global:" and implicitly ends with a "local:*". Set the variables + // needed to simulate that. + if (Args.hasArg(OPT_dynamic_list) || + Args.hasArg(OPT_export_dynamic_symbol)) { + Config->ExportDynamic = true; + if (!Config->Shared) + Config->DefaultSymbolVersion = VER_NDX_LOCAL; + } + } if (auto *Arg = Args.getLastArg(OPT_version_script)) if (Optional Buffer = readFile(Arg->getValue())) @@ -876,6 +880,21 @@ static uint64_t getImageBase(opt::InputA return V; } +// Parses --defsym=alias option. +static std::vector> +getDefsym(opt::InputArgList &Args) { + std::vector> Ret; + for (auto *Arg : Args.filtered(OPT_defsym)) { + StringRef From; + StringRef To; + std::tie(From, To) = StringRef(Arg->getValue()).split('='); + if (!isValidCIdentifier(To)) + error("--defsym: symbol name expected, but got " + To); + Ret.push_back({From, To}); + } + return Ret; +} + // Do actual linking. Note that when this function is called, // all linker scripts have already been parsed. template void LinkerDriver::link(opt::InputArgList &Args) { @@ -893,9 +912,11 @@ template void LinkerDriver: // Fail early if the output file or map file is not writable. If a user has a // long link, e.g. due to a large LTO link, they do not wish to run it and // find that it failed because there was a mistake in their command-line. - if (!isFileWritable(Config->OutputFile, "output file")) - return; - if (!isFileWritable(Config->MapFile, "map file")) + if (auto E = tryCreateFile(Config->OutputFile)) + error("cannot open output file " + Config->OutputFile + ": " + E.message()); + if (auto E = tryCreateFile(Config->MapFile)) + error("cannot open map file " + Config->MapFile + ": " + E.message()); + if (ErrorCount) return; // Use default entry point name if no name was given via the command @@ -941,6 +962,10 @@ template void LinkerDriver: for (auto *Arg : Args.filtered(OPT_wrap)) Symtab.wrap(Arg->getValue()); + // Handle --defsym=sym=alias option. + for (std::pair &Def : getDefsym(Args)) + Symtab.alias(Def.first, Def.second); + // Now that we have a complete list of input files. // Beyond this point, no new files are added. // Aggregate all input sections into one place. Modified: vendor/lld/dist/ELF/Filesystem.cpp ============================================================================== --- vendor/lld/dist/ELF/Filesystem.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/ELF/Filesystem.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -13,7 +13,6 @@ #include "Filesystem.h" #include "Config.h" -#include "Error.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/FileOutputBuffer.h" #include @@ -58,22 +57,20 @@ void elf::unlinkAsync(StringRef Path) { std::thread([=] { ::remove(TempPath.str().str().c_str()); }).detach(); } -// Returns true if a given file seems to be writable. +// Simulate file creation to see if Path is writable. // // Determining whether a file is writable or not is amazingly hard, // and after all the only reliable way of doing that is to actually // create a file. But we don't want to do that in this function // because LLD shouldn't update any file if it will end in a failure. -// We also don't want to reimplement heuristics. So we'll let -// FileOutputBuffer do the work. +// We also don't want to reimplement heuristics to determine if a +// file is writable. So we'll let FileOutputBuffer do the work. // // FileOutputBuffer doesn't touch a desitnation file until commit() // is called. We use that class without calling commit() to predict // if the given file is writable. -bool elf::isFileWritable(StringRef Path, StringRef Desc) { - if (auto EC = FileOutputBuffer::create(Path, 1).getError()) { - error("cannot open " + Desc + " " + Path + ": " + EC.message()); - return false; - } - return true; +std::error_code elf::tryCreateFile(StringRef Path) { + if (Path.empty()) + return std::error_code(); + return FileOutputBuffer::create(Path, 1).getError(); } Modified: vendor/lld/dist/ELF/Filesystem.h ============================================================================== --- vendor/lld/dist/ELF/Filesystem.h Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/ELF/Filesystem.h Wed Apr 26 19:24:42 2017 (r317453) @@ -15,7 +15,7 @@ namespace lld { namespace elf { void unlinkAsync(StringRef Path); -bool isFileWritable(StringRef Path, StringRef FileDescription); +std::error_code tryCreateFile(StringRef Path); } } Modified: vendor/lld/dist/ELF/InputFiles.cpp ============================================================================== --- vendor/lld/dist/ELF/InputFiles.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/ELF/InputFiles.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -608,8 +608,9 @@ ArchiveFile::getMember(const Archive::Sy } template -SharedFile::SharedFile(MemoryBufferRef M) - : ELFFileBase(Base::SharedKind, M), AsNeeded(Config->AsNeeded) {} +SharedFile::SharedFile(MemoryBufferRef M, StringRef DefaultSoName) + : ELFFileBase(Base::SharedKind, M), SoName(DefaultSoName), + AsNeeded(Config->AsNeeded) {} template const typename ELFT::Shdr * @@ -619,12 +620,6 @@ SharedFile::getSection(const Elf_S toString(this)); } -template StringRef SharedFile::getSoName() const { - if (SoName.empty()) - return this->DefaultSoName; - return SoName; -} - // Partially parse the shared object file so that we can call // getSoName on this object. template void SharedFile::parseSoName() { @@ -867,8 +862,23 @@ void BitcodeFile::parse(DenseSet(KeptComdats, ObjSym, this)); } +// Small bit of template meta programming to handle the SharedFile constructor +// being the only one with a DefaultSoName parameter. +template