1. 01 Jan, 2020 1 commit
  2. 26 Apr, 2019 1 commit
    • Eli Zaretskii's avatar
      Avoid compiler warning in dynlib.c · 83cdf7bf
      Eli Zaretskii authored
      * src/dynlib.c (dynlib_addr) [WINDOWSNT]: Rename the first
      argument to be consistent with other platforms.  Cast it to
      'void *' to avoid compiler warning as result of changing the
      function's signature as part of the last recent change in
      dynlib.c.
      83cdf7bf
  3. 25 Apr, 2019 1 commit
    • Paul Eggert's avatar
      Port to Oracle Developer Studio 12.6 · 69947311
      Paul Eggert authored
      This compiler is a bit pickier about checking conformance to
      the C standard, ranging from syntax trivia (no extra ";" at
      the top level) to portability trivia (warnings re conversion
      between function and data pointers) to more-important stuff
      like lack of support for some __attribute__ usages.
      * src/dynlib.c (dynlib_addr): First argument is a function
      pointer, not a data pointer.  All callers changed.
      * src/emacs-module.c (module_function_address):
      Return module_funcptr, not void *.  All uses changed.
      * src/lisp.h (module_funcptr) [HAVE_MODULES]: New type.
      * src/lread.c (union ieee754_double): Don’t assume the usual
      semantics for converting signed to unsigned int when initializing
      a bitfield, as the Oracle compiler complains and the C standard
      is unclear.
      * src/pdumper.c (ALLOW_IMPLICIT_CONVERSION): Make it clearer
      that -Wsign-conversion is disabled everywhere in this file.
      (dump_trace, dump_tailq_prepend, dump_tailq_append):
      Don’t assume __attribute__.
      (dump_object_self_representing_p): Don’t disable conversion
      warnings; it’s not needed here.
      (DEFINE_FROMLISP_FUNC): Avoid possible signal in integer
      conversion from unsigned to signed.
      (DEFINE_FROMLISP_FUNC, finish_dump_pvec): Avoid warning about
      unreachable statements on platforms not supporting the
      __attribute__.
      (intmax_t_from_lisp, intmax_t_to_lisp, dump_off_from_lisp)
      (dump_off_to_lisp, dump_emacs_reloc_immediate_lv)
      (dump_emacs_reloc_immediate_ptrdiff_t)
      (dump_emacs_reloc_immediate_intmax_t)
      (dump_emacs_reloc_immediate_int, dump_emacs_reloc_immediate_bool):
      Omit stray semicolon that violates C standard.
      (dump_metadata_for_pdumper): Add cast to pacify compiler complaining
      about conversion from function pointer to data pointer.
      (Fdump_emacs_portable): Do not use CALLN to call a function
      with zero arguments, as C99 prohibits empty initializers.
      * src/xdisp.c (syms_of_xdisp): Do not nest calls to pure_list,
      to work around a bug in Oracle Developer Studio 12.6.
      69947311
  4. 01 Jan, 2019 1 commit
  5. 17 Aug, 2018 1 commit
    • Andy Moreton's avatar
      Pacify -Wcast-function-type warnings in GCC 8.1 · cc5325b0
      Andy Moreton authored
      * src/image.c: Move attributes into DEF_DLL_FN call.
      * src/dynlib.c (dynlib_addr): Use get_proc_addr.
      * src/w32.h: (get_proc_addr): New function.
      (LOAD_DLL_FN): Use it.
      (DEF_DLL_FN): Allow function attributes after argument
      list.  Add function pointer type used by LOAD_DLL_FN.
      * src/w32.c (open_process_token, get_token_information)
      (lookup_account_sid, get_sid_sub_authority)
      (get_sid_sub_authority_count, get_security_info)
      (get_file_security, set_file_security)
      (set_named_security_info)
      (get_security_descriptor_owner, get_security_descriptor_group)
      (get_security_descriptor_dacl, is_valid_sid, equal_sid)
      (get_length_sid, copy_sid, get_native_system_info)
      (get_system_times, create_symbolic_link)
      (is_valid_security_descriptor, convert_sd_to_sddl)
      (convert_sddl_to_sd, get_adapters_info, reg_open_key_ex_w)
      (reg_query_value_ex_w, expand_environment_strings_w)
      (init_environment, create_toolhelp32_snapshot)
      (process32_first, process32_next, open_thread_token)
      (impersonate_self, revert_to_self, get_process_memory_info)
      (get_process_working_set_size, global_memory_status)
      (global_memory_status_ex, init_winsock)
      (maybe_load_unicows_dll, globals_of_w32): Use get_proc_addr.
      * src/w32fns.c (setup_w32_kbdhook, Ffile_system_info)
      (get_dll_version, w32_reset_stack_overflow_guard)
      (w32_backtrace, globals_of_w32fns): Use get_proc_addr.
      * src/w32font.c (get_outline_metrics_w, get_text_metrics_w)
      (get_glyph_outline_w, get_char_width_32_w): Use get_proc_addr.
      * src/w32heap.c (init_heap): Use get_proc_addr.
      * src/w32menu.c (globals_of_w32menu): Use get_proc_addr.
      * src/w32proc.c (init_timers, sys_kill, w32_compare_strings):
      Use get_proc_addr.
      * src/w32uniscribe.c (syms_of_w32uniscribe): Use get_proc_addr.
      cc5325b0
  6. 01 Jan, 2018 1 commit
  7. 13 Sep, 2017 1 commit
    • Paul Eggert's avatar
      Prefer HTTPS to FTP and HTTP in documentation · bc511a64
      Paul Eggert authored
      Most of this change is to boilerplate commentary such as license URLs.
      This change was prompted by ftp://ftp.gnu.org's going-away party,
      planned for November.  Change these FTP URLs to https://ftp.gnu.org
      instead.  Make similar changes for URLs to other organizations moving
      away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
      fsf.org when this works, as this will further help defend against
      man-in-the-middle attacks (for this part I omitted the MS-DOS and
      MS-Windows sources and the test tarballs to keep the workload down).
      HTTPS is not fully working to lists.gnu.org so I left those URLs alone
      for now.
      bc511a64
  8. 05 Jun, 2017 1 commit
    • Eli Zaretskii's avatar
      Fix emacs-module-tests on MS-Windows · 9ae5c0a2
      Eli Zaretskii authored
      * src/print.c (print_vectorlike): Make sure module function's
      address prints with a leading "0x".  This fixes emacs-module-tests
      on MS-Windows.  Fix whitespace.
      * src/dynlib.c (dynlib_addr): Remove unused variable.  Update
      commentary.
      9ae5c0a2
  9. 04 Jun, 2017 1 commit
  10. 01 Jan, 2017 1 commit
  11. 21 May, 2016 1 commit
    • Eli Zaretskii's avatar
      Fix compiler warnings in the MinGW build · cb5af792
      Eli Zaretskii authored
      * configure.ac [mingw32]: Don't add -Wpointer-sign, and add
      -Wno-pointer-sign, to keep the noise level down.
      
      * nt/mingw-cfg.site (gl_cv_warn_c__Wredundant_decls): Disable
      -Wredundant-decls, as that produces a lot of noise due to
      redeclaration of time-related functions by gnulib.
      * nt/runemacs.c (set_user_model_id): Fix argument type of
      'SetCurrentProcessExplicitAppUserModelID'.
      
      * src/image.c (x_create_bitmap_from_file) [HAVE_NTGUI]: Don't
      declare 'dpyinfo', as it is unused.
      (xpm_load): Fix warnings about pointer signedness.
      * src/w32proc.c (IsValidLocale, init_winsock): Remove redundant
      prototypes.
      (sys_spawnve): Avoid warnings about discarding 'const' qualifier.
      (sys_select): Provide prototype.
      (g_b_init_compare_string_w): Move declaration to file scope.
      * src/w32heap.c (dumped_data_commit): Now static.
      (FREEABLE_P): Avoid warnings about pointer comparison with integer.
      (mmap_realloc): Cast to 'char *' for arithmetics on void pointers.
      * src/w32console.c (ctrl_c_handler, sys_tputs, sys_tgetstr)
      (evalcost, cmputc, cmcheckmagic, cmcostinit, cmgoto, Wcm_clear):
      Provide prototypes.
      * src/w32.c (globals_of_w32, conv_sockaddr_to_lisp): Remove
      redundant prototypes.
      (w32_get_internal_run_time, map_w32_filename): Provide prototype.
      (init_environment, sys_ctime): Avoid warnings about discarding
      'const' qualifier.
      Include utimens.h.
      (sys_ctime, sys_chdir, sys_creat, sys_fopen, sys_mkdir)
      (sys_open, sys_rename, sys_rmdir, is_slow_fs, term_winsock)
      (sys_close, sys_dup2, sys_read, sys_write, sys_localtime): Provide
      prototypes.
      (sys_rename_replace): Use %d to avoid compiler warnings.
      (_wsa_errlist): Make the message text 'const char *', to avoid
      compilation warnings.
      (dynlib_reset_last_error): Move prototype to file scope.
      (w32_get_resource): First argument is now 'const char *'.
      * src/w32uniscribe.c (syms_of_w32uniscribe): Provide prototype.
      (otf_features): Second argument is no 'const char *'.
      * src/w32term.c (free_frame_menubar, x_wm_set_size_hint)
      (x_set_window_size): Remove redundant prototypes.
      (XChangeGC, XGetGCValues, w32_draw_underwave)
      (w32_draw_rectangle, w32_shift_glyphs_for_insert, x_mouse_leave)
      (x_calc_absolute_position, x_destroy_window): Now static.
      (menubar_selection_callback): Move prototype to file scope.
      * src/w32font.c (g_b_init_get_glyph_outline_w): Remove redundant
      declaration.
      (w32_to_x_charset): Fix warnings about discarding 'const' qualifier.
      (w32font_full_name): Fix warnings about implicit conversion of
      'float' to 'double'.
      * src/w32reg.c (w32_get_rdb_resource): Fix warnings about
      discarding 'const' qualifier.
      * src/w32menu.c (syms_of_w32menu, globals_of_w32menu)
      (set_frame_menubar): Remove redundant prototypes.
      (menubar_selection_callback, w32_menu_display_help): Provide
      prototypes.
      (simple_dialog_show): Avoid warnings about discarding 'const'
      qualifier.
      * src/w32fns.c (syms_of_w32fns, globals_of_w32fns)
      (free_frame_menubar, w32_strerror, x_set_menu_bar_lines)
      (x_set_tool_bar_lines, x_set_internal_border_width): Remove
      redundant prototypes.
      (current_popup_menu): Remove redundant declaration.
      (colormap_t): Member 'name' is now 'const char *'.
      (add_system_logical_colors_to_map): Fix signed/unsigned warnings.
      (x_decode_color, x_set_border_pixel)
      (x_clear_under_internal_border, x_set_name, hook_w32_key)
      (reset_w32_kbdhook_state, deliver_wm_chars, w32_backtrace): Now
      static.
      (w32_load_cursor, w32_key_to_modifier, map_keypad_keys)
      (w32_msg_worker, w32_last_error): Provide prototypes.
      (funhook, lookup_vk_code): Avoid warnings about missing
      parentheses.
      (x_default_font_parameter, Fw32_notification_notify): Avoid
      warnings about discarding 'const' qualifier.
      (Fx_create_frame): Avoid warnings about empty body of 'else'.
      (x_screen_planes): Ifdef away unused function.
      (Fx_show_tip): Remove unused variables.
      (Fw32_battery_status): Avoid warnings about implicit promotion
      from float to double.
      (Fw32_notification_notify): Initialize 'timeout'.
      * src/profiler.c (profiler_cpu_running) [HAVE_ITIMERSPEC]: Only
      define the TIMER_SETTIME_RUNNING value if it will be used.
      * src/w32notify.c (send_notifications): Ifdef away an empty if
      clause.  Remove unused variable.
      (watch_end, watch_completion): Provide prototypes.
      * src/sound.c (sound_warning) [WINDOWSNT]: Don't define: unused.
      * src/callproc.c (child_setup, getenv_internal_1) [WINDOWSNT]: Fix
      warning with pointer signedness.
      * src/gnutls.c (gnutls_x509_crt_get_signature)
      (gnutls_alert_send_appropriate) [WINDOWSNT]: Don't define, and
      don't load them from the GnuTLS library, as they are no longer
      used.
      * src/process.c (DATAGRAM_CHAN_P) [!DATAGRAM_SOCKETS]: Don't
      define, as it's unused.
      * src/unexw32.c (open_input_file, open_output_file)
      (close_file_data): Remove redundant prototypes.
      (_start): provide prototype.
      (mainCRTStartup): Move prototype to file level.
      (find_section): Use type-cast to shut up compiler warnings.
      (offset_to_section, relocate_offset): Now static.
      (find_section): First argument is now a 'const char *'.
      (offset_to_section): Ifdef away, as it's unused.
      * src/w32heap.h (find_section): Adjust prototype.
      * src/dynlib.c (dynlib_reset_last_error): Provide prototype.
      * src/dired.c (directory_files_internal_w32_unwind): Avoid
      warnings about missing prototypes.
      (is_slow_fs) [WINDOWSNT]: Provide prototype at file level.
      (directory_files_internal) [WINDOWSNT]: Fix warnings about pointer
      signedness.
      * src/fileio.c (Ffile_writable_p, Ffile_regular_p) [WINDOWSNT]:
      Fix warnings about pointer signedness.
      * src/filelock.c (WTMP_FILE) [WINDOWSNT]: Don't define, it's
      unused.
      * src/sysdep.c (_getpid): Remove redundant prototype.
      (sys_subshell) [DOS_NT]: Don't define 'status', it's unused.
      [!MSDOS]: Don't define 'st', it's unused.
      (init_sys_modes) [DOS_NT]: Don't define 'terminal', it's unused.
      (str_collate) [WINDOWSNT]: Avoid warnings about pointer signedness.
      * src/keyboard.c (tty_read_avail_input) [WINDOWSNT]: Don't define
      n_to_read, as it is not used.
      (MAX_ENCODED_BYTES) [WINDOWSNT]: Don't define, as it's unused.
      * src/w32font.h (syms_of_w32font): Remove redundant prototype.
      * src/xfaces.c (x_display_info) [HAVE_NTGUI]: Remove unused macro.
      * src/term.c (init_tty) [DOS_NT]: Ifdef away variables that are
      not used by DOS_NT builds, to avoid compiler warnings.
      * src/menu.c (current_popup_menu) [HAVE_NTGUI]: Remove redundant
      declaration.
      * src/dispnew.c (init_display) [WINDOWSNT]: Use type-cast to shut
      up compiler warnings.
      * src/w32term.h (x_set_window_size, x_get_focus_frame)
      (x_make_frame_visible, x_make_frame_invisible, x_iconify_frame)
      (x_set_frame_alpha, x_activate_menubar, x_bitmap_icon)
      (x_free_frame_resources, x_real_positions)
      (display_x_get_resource): Remove redundant prototypes.
      
      * lib-src/ntlib.c (sys_ctime, sys_fopen, sys_chdir, mkostemp)
      (sys_rename, gettimeofday): Provide prototypes.
      * lib-src/ntlib.h (getuid, geteuid, mkostemp): Remove redundant
      declarations.
      * lib-src/emacsclient.c (w32_getenv): Argument is now 'const char *'.
      (xstrdup, w32_get_resource, w32_window_app, w32_execvp, ttyname)
      (close_winsock, initialize_sockets, w32_set_user_model_id)
      (w32_find_emacs_process, w32_give_focus) [WINDOWSNT]: Add
      prototypes.
      (w32_get_resource) [WINDOWSNT]: Fix a warning about signedness
      difference.
      (w32_set_user_model_id): Update prototype of
      SetCurrentProcessExplicitAppUserModelID to avoid compiler
      warnings.
      (start_daemon_and_retry_set_socket) [WINDOWSNT]: Use type-cast to
      shut up compiler warnings.
      * lib-src/etags.c (MAXPATHLEN) [WINDOWSNT]: Remove unused macro.
      cb5af792
  12. 10 Mar, 2016 1 commit
    • Paul Eggert's avatar
      Rework C source files to avoid ^( · 7352c6c6
      Paul Eggert authored
      Work around Bug#22884 by rewording comments and strings to avoid ‘(’
      at the start of a line unless it starts a function.  This change
      is a short-term hack; in the longer run we plan to fix cc-mode’s
      performance for C files that have ‘(’ at the start of a line in a
      comment or string.
      7352c6c6
  13. 01 Jan, 2016 1 commit
  14. 24 Nov, 2015 2 commits
    • Eli Zaretskii's avatar
      Implement dynlib_addr for MS-Windows · 146f361a
      Eli Zaretskii authored
      * src/dynlib.c [WINDOWSNT]: Include w32common.h.
      <g_b_init_get_module_handle_ex> [WINDOWSNT]: New static variable.
      (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS)
      (GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT) [WINDOWSNT]: Define
      if undefined.
      (dynlib_reset_last_error): Reset g_b_init_get_module_handle_ex to
      zero.
      (dynlib_addr) [WINDOWSNT]: Non-trivial implementation to report
      the full file name of the module for a given address.
      146f361a
    • Paul Eggert's avatar
      Port better to FreeBSD’s dlfunc vs dlsym · da8c7ca2
      Paul Eggert authored
      This avoids warnings when converting between void * and
      function pointers, which strict C11 does not allow.
      * configure.ac (dlfunc): Check for existence.
      * src/dynlib.c (dlfunc) [!HAVE_DLFUNC]: New macro.
      (dynlib_func): New function.
      * src/dynlib.h (dynlib_function_ptr, dynlib_func): New decls.
      * src/emacs-module.c (Fmodule_load): Use dynlib_func, not
      dynlib_sym, for function pointers.
      da8c7ca2
  15. 20 Nov, 2015 2 commits
    • Eli Zaretskii's avatar
      Improve MS-Windows implementation in dynlib.c · 24be1c84
      Eli Zaretskii authored
      * src/dynlib.c [WINDOWSNT]: Include errno.h, lisp.h, and w32.h.
      No need to include windows.h, as w32.h already does that.
      <dynlib_last_err>: New static variable.
      (dynlib_reset_last_error): New function.
      (dynlib_open): Convert forward slashes to backslashes.  Convert
      file names from UTF-8 to either UTF-16 or the current ANSI
      codepage, and call either LoadLibraryW or LoadLibraryA.  If the
      argument is NULL, return a handle to the main module, like
      'dlopen' does.  Record the error, if any, for use by dynlib_error.
      (dynlib_sym): Check the handle for validity. Record the error, if
      any, for use by dynlib_error.
      (dynlib_error): Call w32_strerror to produce the error string, and
      zero out the last error code, like dlerror does.
      (dynlib_close): Check the handle for validity.  Record the error,
      if any, for use by dynlib_error.  Don't call FreeLibrary with a
      handle for the main module.
      * src/w32.c (globals_of_w32): Call dynlib_reset_last_error.
      24be1c84
    • Paul Eggert's avatar
      Include-file tweaks for modules · c69cec40
      Paul Eggert authored
      * src/dynlib.c, src/emacs-module.c: Include <config.h> first.
      * src/dynlib.h: Do not include config.h.
      It’s every .c file’s responsibility to include config.h first.
      * src/emacs-module.c: Include emacs-module.h immediately after
      config.h, to test that emacs-module.h doesn’t depend on
      include files other than config.h.
      c69cec40
  16. 19 Nov, 2015 3 commits
    • Paul Eggert's avatar
      Fix minor module problems found by static checking · 62d787ed
      Paul Eggert authored
      * src/dynlib.c (dynlib_close): #ifdef out for now, as it’s not used.
      * src/eval.c, src/lisp.h (lisp_eval_depth): Now static.
      * src/module.c (Fmodule_load): Fix pointer signedness bug.
      (Fmodule_call): Tell GCC that the default case is unreachable.
      62d787ed
    • Paul Eggert's avatar
      Style fixes for indenting etc. in module code · c8a972b0
      Paul Eggert authored
      This is mostly indenting and spacing changes.  Also, remove
      some unnecessary static decls instead of bothering to reindent them.
      * src/module.h (EMACS_EXTERN_C_BEGIN): Remove, and do this inline,
      as most other Emacs files do for this sort of thing.
      c8a972b0
    • Paul Eggert's avatar
      Add copyright notices to module code · c8404f48
      Paul Eggert authored
      Put them in the usual format for GNU Emacs copyright notices.
      c8404f48
  17. 18 Nov, 2015 1 commit