Use enum flags for flags passed to openp
authorSimon Marchi <simon.marchi@polymtl.ca>
Tue, 13 Feb 2018 17:13:59 +0000 (12:13 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Tue, 13 Feb 2018 17:13:59 +0000 (12:13 -0500)
gdb/ChangeLog:

* defs.h (enum openp_flags): New enum.
(OPF_TRY_CWD_FIRST, OPF_SEARCH_IN_PATH, OPF_RETURN_REALPATH):
Move to enum openp_flags.
(openp_flags): New enum flags.
(openp): Change parameter type to openp_flags.
* source.c (openp): Change parameter type to openp_flags.
* cli/cli-cmds.c (find_and_open_script): Use openp_flags.
* dwarf2read.c (try_open_dwop_file): Use openp_flags.

gdb/ChangeLog
gdb/cli/cli-cmds.c
gdb/defs.h
gdb/dwarf2read.c
gdb/source.c

index 6ec60ae929830865aec818abd4b11b6b9ea2e9db..a09935f97e4605d7d9cd2d46a4a68c8f2bcf7072 100644 (file)
@@ -1,3 +1,14 @@
+2018-02-13  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * defs.h (enum openp_flags): New enum.
+       (OPF_TRY_CWD_FIRST, OPF_SEARCH_IN_PATH, OPF_RETURN_REALPATH):
+       Move to enum openp_flags.
+       (openp_flags): New enum flags.
+       (openp): Change parameter type to openp_flags.
+       * source.c (openp): Change parameter type to openp_flags.
+       * cli/cli-cmds.c (find_and_open_script): Use openp_flags.
+       * dwarf2read.c (try_open_dwop_file): Use openp_flags.
+
 2018-02-13  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * maint.c (_initialize_maint_cmds): Fix prefix of maint set/show
index 18d1d4b38353bf18a893476f22c2e1ca7c3ebfab..c3962e939ee18548210768866e4623cff28ae687 100644 (file)
@@ -496,7 +496,7 @@ gdb::optional<open_script>
 find_and_open_script (const char *script_file, int search_path)
 {
   int fd;
-  int search_flags = OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH;
+  openp_flags search_flags = OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH;
   gdb::optional<open_script> opened;
 
   gdb::unique_xmalloc_ptr<char> file (tilde_expand (script_file));
index 4fb2129b30796758954231a7a931420278d5b506..70389ad74525683a66f48d1ed69f0763037529dc 100644 (file)
@@ -342,11 +342,17 @@ extern const char *pc_prefix (CORE_ADDR);
 /* From source.c */
 
 /* See openp function definition for their description.  */
-#define OPF_TRY_CWD_FIRST     0x01
-#define OPF_SEARCH_IN_PATH    0x02
-#define OPF_RETURN_REALPATH   0x04
 
-extern int openp (const char *, int, const char *, int, char **);
+enum openp_flag
+{
+  OPF_TRY_CWD_FIRST = 0x01,
+  OPF_SEARCH_IN_PATH = 0x02,
+  OPF_RETURN_REALPATH = 0x04,
+};
+
+DEF_ENUM_FLAGS_TYPE(openp_flag, openp_flags);
+
+extern int openp (const char *, openp_flags, const char *, int, char **);
 
 extern int source_full_path_of (const char *, char **);
 
index cbfd34154a580031bb4ce02ab4b73c242fd16da7..93453431c155273e66c653a55f40dedc6de68aba 100644 (file)
@@ -12880,7 +12880,7 @@ static gdb_bfd_ref_ptr
 try_open_dwop_file (struct dwarf2_per_objfile *dwarf2_per_objfile,
                    const char *file_name, int is_dwp, int search_cwd)
 {
-  int desc, flags;
+  int desc;
   char *absolute_name;
   /* Blech.  OPF_TRY_CWD_FIRST also disables searching the path list if
      FILE_NAME contains a '/'.  So we can't use it.  Instead prepend "."
@@ -12899,7 +12899,7 @@ try_open_dwop_file (struct dwarf2_per_objfile *dwarf2_per_objfile,
   else
     search_path = xstrdup (debug_file_directory);
 
-  flags = OPF_RETURN_REALPATH;
+  openp_flags flags = OPF_RETURN_REALPATH;
   if (is_dwp)
     flags |= OPF_SEARCH_IN_PATH;
   desc = openp (search_path, flags, file_name,
index 009bec5285d9bd1deb2d847226c4b74e6f5ba44b..eba06f6e6baa725c8af46a58f77b7dac00b0d2a7 100644 (file)
@@ -736,7 +736,7 @@ is_regular_file (const char *name, int *errno_ptr)
 /*  >>>> This should only allow files of certain types,
     >>>>  eg executable, non-directory.  */
 int
-openp (const char *path, int opts, const char *string,
+openp (const char *path, openp_flags opts, const char *string,
        int mode, char **filename_opened)
 {
   int fd;
This page took 0.038029 seconds and 4 git commands to generate.