svn commit: r305087 - in projects/clang390-import: contrib/gcc/doc contrib/gcclibs/libcpp contrib/telnet/telnet contrib/tnftp/src tools/regression/capsicum/syscalls
Dimitry Andric
dim at FreeBSD.org
Tue Aug 30 20:30:31 UTC 2016
Author: dim
Date: Tue Aug 30 20:30:29 2016
New Revision: 305087
URL: https://svnweb.freebsd.org/changeset/base/305087
Log:
Merge ^/head r305081 through r305086.
Modified:
projects/clang390-import/contrib/gcc/doc/cpp.texi
projects/clang390-import/contrib/gcclibs/libcpp/ChangeLog.gcc43
projects/clang390-import/contrib/gcclibs/libcpp/internal.h
projects/clang390-import/contrib/gcclibs/libcpp/macro.c
projects/clang390-import/contrib/gcclibs/libcpp/pch.c
projects/clang390-import/contrib/telnet/telnet/commands.c
projects/clang390-import/contrib/tnftp/src/ftp.c
projects/clang390-import/tools/regression/capsicum/syscalls/cap_fcntls_limit.c
projects/clang390-import/tools/regression/capsicum/syscalls/cap_ioctls_limit.c
Directory Properties:
projects/clang390-import/ (props changed)
projects/clang390-import/contrib/gcc/ (props changed)
projects/clang390-import/contrib/tnftp/ (props changed)
Modified: projects/clang390-import/contrib/gcc/doc/cpp.texi
==============================================================================
--- projects/clang390-import/contrib/gcc/doc/cpp.texi Tue Aug 30 20:27:22 2016 (r305086)
+++ projects/clang390-import/contrib/gcc/doc/cpp.texi Tue Aug 30 20:30:29 2016 (r305087)
@@ -1912,6 +1912,13 @@ underscores.
@table @code
+ at item __COUNTER__
+This macro expands to sequential integral values starting from 0. In
+conjuction with the @code{##} operator, this provides a convenient means to
+generate unique identifiers. Care must be taken to ensure that
+ at code{__COUNTER__} is not expanded prior to inclusion of precompiled headers
+which use it. Otherwise, the precompiled headers will not be used.
+
@item __GNUC__
@itemx __GNUC_MINOR__
@itemx __GNUC_PATCHLEVEL__
Modified: projects/clang390-import/contrib/gcclibs/libcpp/ChangeLog.gcc43
==============================================================================
--- projects/clang390-import/contrib/gcclibs/libcpp/ChangeLog.gcc43 Tue Aug 30 20:27:22 2016 (r305086)
+++ projects/clang390-import/contrib/gcclibs/libcpp/ChangeLog.gcc43 Tue Aug 30 20:30:29 2016 (r305087)
@@ -12,6 +12,17 @@
PR preprocessor/14331
* lex.c (_cpp_get_fresh_line): Don't warn if no newline at EOF.
+2007-05-24 Ollie Wild <aaw at google.com> (r125041)
+
+ * macro.c (_cpp_builtin_macro_text): Handle BT_COUNTER.
+ * pch.c (cpp_write_pch_deps): Save __COUNTER__ state.
+ (cpp_write_pch_state): Save __COUNTER__ state.
+ (cpp_valid_state): Check valid __COUNTER__ state.
+ (cpp_read_state): Read new __COUNTER__ state.
+ * include/cpplib.h (enum builtin_type): Add BT_COUNTER enumerator.
+ * init.c (builtin_array): Add __COUNTER__/BT_COUNTER.
+ * internal.h (struct cpp_reader): Add counter member.
+
2007-05-21 Ian Lance Taylor <iant at google.com> (r124929)
* internal.h (struct cpp_reader): Add new fields:
Modified: projects/clang390-import/contrib/gcclibs/libcpp/internal.h
==============================================================================
--- projects/clang390-import/contrib/gcclibs/libcpp/internal.h Tue Aug 30 20:27:22 2016 (r305086)
+++ projects/clang390-import/contrib/gcclibs/libcpp/internal.h Tue Aug 30 20:30:29 2016 (r305087)
@@ -458,7 +458,8 @@ struct cpp_reader
of precompiled headers. */
struct cpp_savedstate *savedstate;
- unsigned int nextcounter;
+ /* Next value of __COUNTER__ macro. */
+ unsigned int counter;
};
/* Character classes. Based on the more primitive macros in safe-ctype.h.
Modified: projects/clang390-import/contrib/gcclibs/libcpp/macro.c
==============================================================================
--- projects/clang390-import/contrib/gcclibs/libcpp/macro.c Tue Aug 30 20:27:22 2016 (r305086)
+++ projects/clang390-import/contrib/gcclibs/libcpp/macro.c Tue Aug 30 20:30:29 2016 (r305087)
@@ -268,7 +268,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
if (CPP_OPTION (pfile, directives_only) && pfile->state.in_directive)
cpp_error (pfile, CPP_DL_ERROR,
"__COUNTER__ expanded inside directive with -fdirectives-only");
- number = pfile->nextcounter++;
+ number = pfile->counter++;
break;
}
Modified: projects/clang390-import/contrib/gcclibs/libcpp/pch.c
==============================================================================
--- projects/clang390-import/contrib/gcclibs/libcpp/pch.c Tue Aug 30 20:27:22 2016 (r305086)
+++ projects/clang390-import/contrib/gcclibs/libcpp/pch.c Tue Aug 30 20:30:29 2016 (r305087)
@@ -337,6 +337,14 @@ cpp_write_pch_deps (cpp_reader *r, FILE
/* Free the saved state. */
free (ss);
r->savedstate = NULL;
+
+ /* Save the next value of __COUNTER__. */
+ if (fwrite (&r->counter, sizeof (r->counter), 1, f) != 1)
+ {
+ cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
+ return -1;
+ }
+
return 0;
}
@@ -361,6 +369,15 @@ cpp_write_pch_state (cpp_reader *r, FILE
return -1;
}
+ /* Save the next __COUNTER__ value. When we include a precompiled header,
+ we need to start at the offset we would have if the header had been
+ included normally. */
+ if (fwrite (&r->counter, sizeof (r->counter), 1, f) != 1)
+ {
+ cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
+ return -1;
+ }
+
return 0;
}
@@ -423,6 +440,7 @@ cpp_valid_state (cpp_reader *r, const ch
struct ht_node_list nl = { 0, 0, 0 };
unsigned char *first, *last;
unsigned int i;
+ unsigned int counter;
/* Read in the list of identifiers that must be defined
Check that they are defined in the same way. */
@@ -524,7 +542,23 @@ cpp_valid_state (cpp_reader *r, const ch
}
free(nl.defs);
+ nl.defs = NULL;
free (undeftab);
+ undeftab = NULL;
+
+ /* Read in the next value of __COUNTER__.
+ Check that (a) __COUNTER__ was not used in the pch or (b) __COUNTER__
+ has not been used in this translation unit. */
+ if (read (fd, &counter, sizeof (counter)) != sizeof (counter))
+ goto error;
+ if (counter && r->counter)
+ {
+ if (CPP_OPTION (r, warn_invalid_pch))
+ cpp_error (r, CPP_DL_WARNING_SYSHDR,
+ "%s: not used because `__COUNTER__' is invalid",
+ name);
+ goto fail;
+ }
/* We win! */
return 0;
@@ -631,6 +665,7 @@ cpp_read_state (cpp_reader *r, const cha
{
size_t i;
struct lexer_state old_state;
+ unsigned int counter;
/* Restore spec_nodes, which will be full of references to the old
hashtable entries and so will now be invalid. */
@@ -690,6 +725,12 @@ cpp_read_state (cpp_reader *r, const cha
if (! _cpp_read_file_entries (r, f))
goto error;
+ if (fread (&counter, sizeof (counter), 1, f) != 1)
+ goto error;
+
+ if (!r->counter)
+ r->counter = counter;
+
return 0;
error:
Modified: projects/clang390-import/contrib/telnet/telnet/commands.c
==============================================================================
--- projects/clang390-import/contrib/telnet/telnet/commands.c Tue Aug 30 20:27:22 2016 (r305086)
+++ projects/clang390-import/contrib/telnet/telnet/commands.c Tue Aug 30 20:30:29 2016 (r305087)
@@ -112,7 +112,7 @@ static int send_tncmd(void (*)(int, int)
static int setmod(int);
static int clearmode(int);
static int modehelp(void);
-static int sourceroute(struct addrinfo *, char *, char **, int *, int *, int *);
+static int sourceroute(struct addrinfo *, char *, unsigned char **, int *, int *, int *);
typedef struct {
const char *name; /* command name */
@@ -2171,7 +2171,7 @@ switch_af(struct addrinfo **aip)
int
tn(int argc, char *argv[])
{
- char *srp = 0;
+ unsigned char *srp = 0;
int proto, opt;
int srlen;
int srcroute = 0, result;
@@ -2844,10 +2844,10 @@ cmdrc(char *m1, char *m2)
* setsockopt, as socket protocol family.
*/
static int
-sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, int *optp)
+sourceroute(struct addrinfo *ai, char *arg, unsigned char **cpp, int *lenp, int *protop, int *optp)
{
static char buf[1024 + ALIGNBYTES]; /*XXX*/
- char *cp, *cp2, *lsrp, *ep;
+ unsigned char *cp, *cp2, *lsrp, *ep;
struct sockaddr_in *_sin;
#ifdef INET6
struct sockaddr_in6 *sin6;
Modified: projects/clang390-import/contrib/tnftp/src/ftp.c
==============================================================================
--- projects/clang390-import/contrib/tnftp/src/ftp.c Tue Aug 30 20:27:22 2016 (r305086)
+++ projects/clang390-import/contrib/tnftp/src/ftp.c Tue Aug 30 20:30:29 2016 (r305087)
@@ -2050,7 +2050,7 @@ abort_squared(int dummy)
void
abort_remote(FILE *din)
{
- char buf[BUFSIZ];
+ unsigned char buf[BUFSIZ];
int nfnd;
if (cout == NULL) {
Modified: projects/clang390-import/tools/regression/capsicum/syscalls/cap_fcntls_limit.c
==============================================================================
--- projects/clang390-import/tools/regression/capsicum/syscalls/cap_fcntls_limit.c Tue Aug 30 20:27:22 2016 (r305086)
+++ projects/clang390-import/tools/regression/capsicum/syscalls/cap_fcntls_limit.c Tue Aug 30 20:30:29 2016 (r305087)
@@ -157,13 +157,16 @@ static void
fcntl_tests_1(int fd)
{
uint32_t fcntlrights;
+ cap_rights_t rights;
CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL) == 0);
fcntlrights = 0;
CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
CHECK(fcntlrights == CAP_FCNTL_GETFL);
- CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_FCNTL) == 0);
+ CAP_ALL(&rights);
+ cap_rights_clear(&rights, CAP_FCNTL);
+ CHECK(cap_rights_limit(fd, &rights) == 0);
fcntlrights = CAP_FCNTL_ALL;
CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
@@ -206,8 +209,11 @@ static void
fcntl_tests_2(int fd)
{
uint32_t fcntlrights;
+ cap_rights_t rights;
- CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_FCNTL) == 0);
+ CAP_ALL(&rights);
+ cap_rights_clear(&rights, CAP_FCNTL);
+ CHECK(cap_rights_limit(fd, &rights) == 0);
fcntlrights = CAP_FCNTL_ALL;
CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
Modified: projects/clang390-import/tools/regression/capsicum/syscalls/cap_ioctls_limit.c
==============================================================================
--- projects/clang390-import/tools/regression/capsicum/syscalls/cap_ioctls_limit.c Tue Aug 30 20:27:22 2016 (r305086)
+++ projects/clang390-import/tools/regression/capsicum/syscalls/cap_ioctls_limit.c Tue Aug 30 20:30:29 2016 (r305087)
@@ -131,6 +131,7 @@ static void
ioctl_tests_1(int fd)
{
unsigned long cmds[2];
+ cap_rights_t rights;
cmds[0] = FIOCLEX;
CHECK(cap_ioctls_limit(fd, cmds, 1) == 0);
@@ -139,7 +140,10 @@ ioctl_tests_1(int fd)
CHECK(cmds[0] == FIOCLEX);
CHECK(cmds[1] == 0);
- CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_IOCTL) == 0);
+ CAP_ALL(&rights);
+ cap_rights_clear(&rights, CAP_IOCTL);
+
+ CHECK(cap_rights_limit(fd, &rights) == 0);
CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
cmds[0] = FIOCLEX;
@@ -173,8 +177,12 @@ static void
ioctl_tests_2(int fd)
{
unsigned long cmds[2];
+ cap_rights_t rights;
+
+ CAP_ALL(&rights);
+ cap_rights_clear(&rights, CAP_IOCTL);
- CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_IOCTL) == 0);
+ CHECK(cap_rights_limit(fd, &rights) == 0);
CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
cmds[0] = FIOCLEX;
More information about the svn-src-projects
mailing list