This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[i386] Remove some duplicate code in the DJGPP include file.


As a followup to the DJGPP patch just submitted, I made the real correction for

PR target/8787.

Checking all the include files in config/i386

bsd.h, att.h, gas.h, linux.h, and djgpp.h all define ASM_FILE_PRINT similarly, which the exception of bsd.h which completely ignores the -masm=intel change
that was applied to the others in 2000.


Now for the twisty maze of passages all alike:

a) Every include of bsd.h is immediately followed by gas.h.

b) Every include of gas.h is immediately preceded by bsd.h.

c) Every include of linux.h is preceded by ../linux.h, ../svr4.h, ../elfos.h,
../dbxelf.h and att.h (in reverse order).

d) Every include of djgpp.h (just DJGPP) is preceded by gas.h and bsd.h.

---

Either bsd.h or gas.h can have the duplicate definition deleted due to
a) and b). Based on the RMS comment (which predates CVS) in bsd.h and the fact that it was never updated for -masm=intel, I chose the definition in bsd.h to delete.


Because of d) the definition in djgpp.h is redundant, so it can go.

According to c) the linux.h definition needs to stay in place, even though
it wants to duplicate the definition in att.h, since ../elfos.h redefines ASM_FILE_PRINT to something different.


Finally, I moved one line in gas.h to output '.intel_syntax' after '.file'
so it matches both the comment and the definition that is in {att,linux}.h.

Needless to say, there is a lot more duplicate code in these files.

Verified via cross compile to i686-pc-msdosdjgpp and inspecting a test .s
files with -masm=att and -masm=intel.

Kelley Cook

2003-06-10  Kelley Cook  <kelleycook@wideopenwest.com>

	* config/i386/bsd.h: Remove ASM_FILE_START.
	* config/i386/djgpp.h: Likewise.
	* config/i386/gas.h (ASM_FILE_START): Output .file before .intel_syntax. 

*** config/i386/bsd.h~	Tue Jun 10 16:25:45 2003
--- config/i386/bsd.h	Tue Jun 10 16:26:12 2003
***************
*** 36,48 ****
  #define ASM_LONG "\t.long\t"
  #define ASM_QUAD "\t.quad\t"  /* Should not be used for 32bit compilation.  */
  
- /* Output at beginning of assembler file.
-    ??? I am skeptical of this -- RMS.  */
- 
- #define ASM_FILE_START(FILE) \
-   do {	output_file_directive (FILE, main_input_filename);	\
-   } while (0)
- 
  /* This was suggested, but it shouldn't be right for DBX output. -- RMS
     #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) */
  
--- 36,41 ----
*** config/i386/djgpp.h~	Tue Jun 10 15:27:43 2003
--- config/i386/djgpp.h	Tue Jun 10 16:23:11 2003
***************
*** 130,146 ****
  /* Switch into a generic section.  */
  #define TARGET_ASM_NAMED_SECTION  default_coff_asm_named_section
  
- /* Output at beginning of assembler file.  */
- /* The .file command should always begin the output.  */
- 
- #undef ASM_FILE_START
- #define ASM_FILE_START(FILE)						\
-   do {									\
- 	if (ix86_asm_dialect == ASM_INTEL)				\
- 	  fputs ("\t.intel_syntax\n", FILE);				\
- 	output_file_directive (FILE, main_input_filename);		\
-   } while (0)
- 
  /* This is how to output an assembler line
     that says to advance the location counter
     to a multiple of 2**LOG bytes.  */
--- 126,131 ----
*** config/i386/gas.h~	Tue Jun 10 16:36:50 2003
--- config/i386/gas.h	Tue Jun 10 16:37:06 2003
***************
*** 126,132 ****
  #undef ASM_FILE_START
  #define ASM_FILE_START(FILE)						\
    do {									\
  	if (ix86_asm_dialect == ASM_INTEL)				\
  	  fputs ("\t.intel_syntax\n", FILE);				\
-         output_file_directive (FILE, main_input_filename);		\
    } while (0)
--- 126,132 ----
  #undef ASM_FILE_START
  #define ASM_FILE_START(FILE)						\
    do {									\
+         output_file_directive (FILE, main_input_filename);		\
  	if (ix86_asm_dialect == ASM_INTEL)				\
  	  fputs ("\t.intel_syntax\n", FILE);				\
    } while (0)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]