about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2019-02-22 01:32:36 +0000
committerJoseph Myers <joseph@codesourcery.com>2019-02-22 01:32:36 +0000
commit34a5a1460e9c05d6035bfbde327ab6d45f78958b (patch)
tree2b607b87a53dd463fe92bf291895af86060b792f /elf
parentb0b50fe005d739412c9fc752377021b3007c5d80 (diff)
downloadglibc-34a5a1460e9c05d6035bfbde327ab6d45f78958b.tar.gz
glibc-34a5a1460e9c05d6035bfbde327ab6d45f78958b.tar.xz
glibc-34a5a1460e9c05d6035bfbde327ab6d45f78958b.zip
Break some lines before not after operators.
The GNU Coding Standards specify that line breaks in expressions
should go before an operator, not after one.  This patch fixes various
code to do this.  It only changes code that appears to be mostly
following GNU style anyway, not files and directories with
substantially different formatting.  It is not exhaustive even for
files using GNU style (for example, changes to sysdeps files are
deferred for subsequent cleanups).  Some files changed are shared with
gnulib, but most are specific to glibc.  Changes were made manually,
with places to change found by grep (so some cases, e.g. where the
operator was followed by a comment at end of line, are particularly
liable to have been missed by grep, but I did include cases where the
operator was followed by backslash-newline).

This patch generally does not attempt to address other coding style
issues in the expressions changed (for example, missing spaces before
'(', or lack of parentheses to ensure indentation of continuation
lines properly reflects operator precedence).

Tested for x86_64, and with build-many-glibcs.py.

	* benchtests/bench-memmem.c (simple_memmem): Break lines before
	rather than after operators.
	* benchtests/bench-skeleton.c (TIMESPEC_AFTER): Likewise.
	* crypt/md5.c (md5_finish_ctx): Likewise.
	* crypt/sha256.c (__sha256_finish_ctx): Likewise.
	* crypt/sha512.c (__sha512_finish_ctx): Likewise.
	* elf/cache.c (load_aux_cache): Likewise.
	* elf/dl-load.c (open_verify): Likewise.
	* elf/get-dynamic-info.h (elf_get_dynamic_info): Likewise.
	* elf/readelflib.c (process_elf_file): Likewise.
	* elf/rtld.c (dl_main): Likewise.
	* elf/sprof.c (generate_call_graph): Likewise.
	* hurd/ctty-input.c (_hurd_ctty_input): Likewise.
	* hurd/ctty-output.c (_hurd_ctty_output): Likewise.
	* hurd/dtable.c (reauth_dtable): Likewise.
	* hurd/getdport.c (__getdport): Likewise.
	* hurd/hurd/signal.h (_hurd_interrupted_rpc_timeout): Likewise.
	* hurd/hurd/sigpreempt.h (HURD_PREEMPT_SIGNAL_P): Likewise.
	* hurd/hurdfault.c (_hurdsig_fault_catch_exception_raise):
	Likewise.
	* hurd/hurdioctl.c (fioctl): Likewise.
	* hurd/hurdselect.c (_hurd_select): Likewise.
	* hurd/hurdsig.c (_hurdsig_abort_rpcs): Likewise.
	(STOPSIGS): Likewise.
	* hurd/hurdstartup.c (_hurd_startup): Likewise.
	* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Likewise.
	* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Likewise.
	* hurd/msgportdemux.c (msgport_server): Likewise.
	* hurd/setauth.c (_hurd_setauth): Likewise.
	* include/features.h (__GLIBC_USE_DEPRECATED_SCANF): Likewise.
	* libio/libioP.h [IO_DEBUG] (CHECK_FILE): Likewise.
	* locale/programs/ld-ctype.c (set_class_defaults): Likewise.
	* localedata/tests-mbwc/tst_swscanf.c (tst_swscanf): Likewise.
	* login/tst-utmp.c (do_check): Likewise.
	(simulate_login): Likewise.
	* mach/lowlevellock.h (lll_lock): Likewise.
	(lll_trylock): Likewise.
	* math/test-fenv.c (ALL_EXC): Likewise.
	* math/test-fenvinline.c (ALL_EXC): Likewise.
	* misc/sys/cdefs.h (__attribute_deprecated_msg__): Likewise.
	* nis/nis_call.c (__do_niscall3): Likewise.
	* nis/nis_callback.c (cb_prog_1): Likewise.
	* nis/nis_defaults.c (searchaccess): Likewise.
	* nis/nis_findserv.c (__nis_findfastest_with_timeout): Likewise.
	* nis/nis_ismember.c (internal_ismember): Likewise.
	* nis/nis_local_names.c (nis_local_principal): Likewise.
	* nis/nss_nis/nis-rpc.c (_nss_nis_getrpcbyname_r): Likewise.
	* nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_getnetgrent_r):
	Likewise.
	* nis/ypclnt.c (yp_match): Likewise.
	(yp_first): Likewise.
	(yp_next): Likewise.
	(yp_master): Likewise.
	(yp_order): Likewise.
	* nscd/hstcache.c (cache_addhst): Likewise.
	* nscd/initgrcache.c (addinitgroupsX): Likewise.
	* nss/nss_compat/compat-pwd.c (copy_pwd_changes): Likewise.
	(internal_getpwuid_r): Likewise.
	* nss/nss_compat/compat-spwd.c (copy_spwd_changes): Likewise.
	* posix/glob.h (__GLOB_FLAGS): Likewise.
	* posix/regcomp.c (peek_token): Likewise.
	(peek_token_bracket): Likewise.
	(parse_expression): Likewise.
	* posix/regexec.c (sift_states_iter_mb): Likewise.
	(check_node_accept_bytes): Likewise.
	* posix/tst-spawn3.c (do_test): Likewise.
	* posix/wordexp-test.c (testit): Likewise.
	* posix/wordexp.c (parse_tilde): Likewise.
	(exec_comm): Likewise.
	* posix/wordexp.h (__WRDE_FLAGS): Likewise.
	* resource/vtimes.c (TIMEVAL_TO_VTIMES): Likewise.
	* setjmp/sigjmp.c (__sigjmp_save): Likewise.
	* stdio-common/printf_fp.c (__printf_fp_l): Likewise.
	* stdio-common/tst-fileno.c (do_test): Likewise.
	* stdio-common/vfprintf-internal.c (vfprintf): Likewise.
	* stdlib/strfmon_l.c (__vstrfmon_l_internal): Likewise.
	* stdlib/strtod_l.c (round_and_return): Likewise.
	(____STRTOF_INTERNAL): Likewise.
	* stdlib/tst-strfrom.h (TEST_STRFROM): Likewise.
	* string/strcspn.c (STRCSPN): Likewise.
	* string/test-memmem.c (simple_memmem): Likewise.
	* termios/tcsetattr.c (tcsetattr): Likewise.
	* time/alt_digit.c (_nl_parse_alt_digit): Likewise.
	* time/asctime.c (asctime_internal): Likewise.
	* time/strptime_l.c (__strptime_internal): Likewise.
	* time/sys/time.h (timercmp): Likewise.
	* time/tzfile.c (__tzfile_compute): Likewise.
Diffstat (limited to 'elf')
-rw-r--r--elf/cache.c6
-rw-r--r--elf/dl-load.c16
-rw-r--r--elf/get-dynamic-info.h4
-rw-r--r--elf/readelflib.c8
-rw-r--r--elf/rtld.c4
-rw-r--r--elf/sprof.c4
6 files changed, 21 insertions, 21 deletions
diff --git a/elf/cache.c b/elf/cache.c
index b8e9e6ccc3..b8934898b6 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -712,9 +712,9 @@ load_aux_cache (const char *aux_cache_name)
   if (aux_cache == MAP_FAILED
       || aux_cache_size < sizeof (struct aux_cache_file)
       || memcmp (aux_cache->magic, AUX_CACHEMAGIC, sizeof AUX_CACHEMAGIC - 1)
-      || aux_cache_size != (sizeof(struct aux_cache_file) +
-			    aux_cache->nlibs * sizeof(struct aux_cache_file_entry) +
-			    aux_cache->len_strings))
+      || aux_cache_size != (sizeof(struct aux_cache_file)
+			    + aux_cache->nlibs * sizeof(struct aux_cache_file_entry)
+			    + aux_cache->len_strings))
     {
       close (fd);
       init_aux_cache ();
diff --git a/elf/dl-load.c b/elf/dl-load.c
index f972524421..0e759cf8ca 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1581,15 +1581,15 @@ open_verify (const char *name, int fd,
 	  const Elf32_Word *magp = (const void *) ehdr->e_ident;
 	  if (*magp !=
 #if BYTE_ORDER == LITTLE_ENDIAN
-	      ((ELFMAG0 << (EI_MAG0 * 8)) |
-	       (ELFMAG1 << (EI_MAG1 * 8)) |
-	       (ELFMAG2 << (EI_MAG2 * 8)) |
-	       (ELFMAG3 << (EI_MAG3 * 8)))
+	      ((ELFMAG0 << (EI_MAG0 * 8))
+	       | (ELFMAG1 << (EI_MAG1 * 8))
+	       | (ELFMAG2 << (EI_MAG2 * 8))
+	       | (ELFMAG3 << (EI_MAG3 * 8)))
 #else
-	      ((ELFMAG0 << (EI_MAG3 * 8)) |
-	       (ELFMAG1 << (EI_MAG2 * 8)) |
-	       (ELFMAG2 << (EI_MAG1 * 8)) |
-	       (ELFMAG3 << (EI_MAG0 * 8)))
+	      ((ELFMAG0 << (EI_MAG3 * 8))
+	       | (ELFMAG1 << (EI_MAG2 * 8))
+	       | (ELFMAG2 << (EI_MAG1 * 8))
+	       | (ELFMAG3 << (EI_MAG0 * 8)))
 #endif
 	      )
 	    errstring = N_("invalid ELF header");
diff --git a/elf/get-dynamic-info.h b/elf/get-dynamic-info.h
index 0e4cc735f3..75fbb88f78 100644
--- a/elf/get-dynamic-info.h
+++ b/elf/get-dynamic-info.h
@@ -49,8 +49,8 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
     {
       if ((d_tag_utype) dyn->d_tag < DT_NUM)
 	info[dyn->d_tag] = dyn;
-      else if (dyn->d_tag >= DT_LOPROC &&
-	       dyn->d_tag < DT_LOPROC + DT_THISPROCNUM)
+      else if (dyn->d_tag >= DT_LOPROC
+	       && dyn->d_tag < DT_LOPROC + DT_THISPROCNUM)
 	{
 	  /* This does not violate the array bounds of l->l_info, but
 	     gcc 4.6 on sparc somehow does not see this.  */
diff --git a/elf/readelflib.c b/elf/readelflib.c
index 470b09d1aa..ca4dc6f11e 100644
--- a/elf/readelflib.c
+++ b/elf/readelflib.c
@@ -164,10 +164,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 	      if (size == 0)
 		break;
 
-	      *osversion = (abi_note [4] << 24) |
-			   ((abi_note [5] & 0xff) << 16) |
-			   ((abi_note [6] & 0xff) << 8) |
-			   (abi_note [7] & 0xff);
+	      *osversion = ((abi_note [4] << 24)
+			    | ((abi_note [5] & 0xff) << 16)
+			    | ((abi_note [6] & 0xff) << 8)
+			    | (abi_note [7] & 0xff));
 	    }
 	  break;
 
diff --git a/elf/rtld.c b/elf/rtld.c
index c1cc1b01f2..1b38c6b732 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2110,8 +2110,8 @@ ERROR: '%s': cannot process note segment.\n", _dl_argv[0]);
       liblist = (ElfW(Lib) *)
 		main_map->l_info[ADDRIDX (DT_GNU_LIBLIST)]->d_un.d_ptr;
       liblistend = (ElfW(Lib) *)
-		   ((char *) liblist +
-		    main_map->l_info[VALIDX (DT_GNU_LIBLISTSZ)]->d_un.d_val);
+		   ((char *) liblist
+		    + main_map->l_info[VALIDX (DT_GNU_LIBLISTSZ)]->d_un.d_val);
       r_list = main_map->l_searchlist.r_list;
       r_listend = r_list + main_map->l_searchlist.r_nlist;
 
diff --git a/elf/sprof.c b/elf/sprof.c
index 07829c27de..06d5ca2aff 100644
--- a/elf/sprof.c
+++ b/elf/sprof.c
@@ -1354,8 +1354,8 @@ generate_call_graph (struct profdata *profdata)
 		     ? sortsym[runp->idx]->ticks * tick_unit : 0.0),
 		    0.0, /* FIXME: what's time for the children, recursive */
 		    runp->count, sortsym[cnt]->calls,
-		    (runp->idx != (size_t) -1l ?
-		     sortsym[runp->idx]->name : "<UNKNOWN>"));
+		    (runp->idx != (size_t) -1l
+		     ? sortsym[runp->idx]->name : "<UNKNOWN>"));
 
 	    if (runp->idx != (size_t) -1l)
 	      printf (" [%Zd]", runp->idx);